Package ClusterShell :: Module Task
[hide private]
[frames] | no frames]

Module Task

source code


ClusterShell Task module.

Simple example of use:

    from ClusterShell.Task import *

    # get task associated with calling thread
    task = task_self()

    # add a command to execute on distant nodes
    task.shell("/bin/uname -r", nodes="tiger[1-30,35]")

    # run task in calling thread
    task.resume()

    # get results
    for buf, nodelist in task.iter_buffers():
        print NodeSet.fromlist(nodelist), buf

Classes [hide private]
  TaskException
Base task exception.
  TimeoutError
Raised when the task timed out.
  AlreadyRunningError
Raised when trying to resume an already running task.
  Task
Task to execute.
Functions [hide private]
 
_task_print_debug(task, s)
Default task debug printing function.
source code
 
task_self()
Get the Task instance bound to the current thread.
source code
 
task_wait()
Suspend execution of the calling thread until all tasks terminate, unless all tasks have already terminated.
source code
Variables [hide private]
  __package__ = 'ClusterShell'
Function Details [hide private]

_task_print_debug(task, s)

source code 

Default task debug printing function. Cannot provide 'print' directly as it is not a function (will be in Py3k!).

task_self()

source code 

Get the Task instance bound to the current thread. This function provided as a convenience is available in the top-level ClusterShell.Task package namespace.

task_wait()

source code 

Suspend execution of the calling thread until all tasks terminate, unless all tasks have already terminated. This function is provided as a convenience and is available in the top-level ClusterShell.Task package namespace.