Fork me on GitHub

pyhrf.grid module

Module to distribute shell commands across a network

Original Author: Mathieu Perrot Extended by: Thomas Vincent

class pyhrf.grid.DispatchedTasksManager(*args, **kwargs)

Bases: pyhrf.grid.TasksManager

start()
wait_for_end_or_cmd(print_number, tasks_number, cmd)
class pyhrf.grid.HierarchicalTasksManager(*args, **kwargs)

Bases: pyhrf.grid.DispatchedTasksManager

start()
class pyhrf.grid.Host(name, status)

Bases: object

name : hostname. status : set host status :

class pyhrf.grid.HostsManager(list)

Bases: object

available_status = 0
isup(hostname)
not_available_status = 1
probe(hostname)
unknown_host_status = 2
unknown_status = 3
update_all_hosts()
update_host_status(host, status)
class pyhrf.grid.OneTaskManager(*args, **kwargs)

Bases: pyhrf.grid.TasksManager

abnormal_stop(task)
start()
class pyhrf.grid.ProbeHost(hosts_manager, hostname)

Bases: threading.Thread

run()

Method representing the thread’s activity.

You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.

class pyhrf.grid.RepeatedTasksManager(*args, **kwargs)

Bases: pyhrf.grid.TasksManager

abnormal_stop(task)
start()
class pyhrf.grid.Task(task)

Bases: object

Only one task that will be computed on only one host.

get()
class pyhrf.grid.TaskHierarchical(rule, tasks_dic)

Bases: pyhrf.grid.Task

Hiearchic dependencies of TaskList.

init()
next()
class pyhrf.grid.TaskList(tasks)

Bases: pyhrf.grid.Task

List of independent tasks. Each one can be computed on a different task.

append(task)
next()
class pyhrf.grid.TasksManager(timeslot, user, tasks, hosts_manager, log, brokenfd, time_limit=86400)

Bases: object

abnormal_stop(task)
print_status(n, size)
wait_to_be_ready()
class pyhrf.grid.TasksStarter(tasks_manager, host, task, time_limit=86400)

Bases: threading.Thread

kill()
run()

Method representing the thread’s activity.

You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.

class pyhrf.grid.TimeSlot(start, end)

Bases: object

Define a contiguous timeslot.

start, end : in second since day beggining.

is_inside(time)
is_inside_now()
class pyhrf.grid.TimeSlotList(list)

Bases: pyhrf.grid.TimeSlot

Define uncontiguous timslots.

list : list of timeslots.

is_inside(time)
class pyhrf.grid.User(name=None, passwd=None, keytype=None)

Bases: object

Define user launching task and identification process.

Parameters:
  • name – username.
  • passwd – user passwd or if None, try to get ~/.ssh/id_dsa dsa key for key connection.
  • keytypersa or dsa.
key()
pyhrf.grid.broken_help(cmd)
pyhrf.grid.create_options(argv)
pyhrf.grid.hosts_help(cmd)
pyhrf.grid.kill_threads()
pyhrf.grid.log_help(cmd)
pyhrf.grid.main()
pyhrf.grid.main_safe()
pyhrf.grid.mode_help(cmd)
pyhrf.grid.parse_options(parser)
pyhrf.grid.quit(signal, frame)
pyhrf.grid.read_hierarchic_tasks(tasks_file)
pyhrf.grid.read_hosts(hosts)
pyhrf.grid.read_tasks(tasks, mode)
pyhrf.grid.read_timeslot(timeslot)
pyhrf.grid.remote_dir_is_writable(user, hosts, path)

Test if path is writable from each host in hosts. Sending bash commands to each host via ssh using the given user login.

Args:

pyhrf.grid.run_grid(mode, hosts_list, keytype, tasks, timeslot, brokenfile=None, logfile=None, user=None, passwd=None, time_limit=86400)
pyhrf.grid.tasks_help(cmd)
pyhrf.grid.timeslot_help(cmd)