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.
  TaskError
Base task error exception.
  TimeoutError
Raised when the task timed out.
  AlreadyRunningError
Raised when trying to resume an already running task.
  TaskMsgTreeError
Raised when trying to access disabled MsgTree.
  _TaskMsgTree
Task special MsgTree wrapper class, for easy disabling of MsgTree buffering.
  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
 
task_terminate()
Destroy the Task instance bound to the current thread.
source code
 
task_cleanup()
Cleanup routine to destroy all created tasks.
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.

task_terminate()

source code 

Destroy the Task instance bound to the current thread. A next call to task_self() will create a new Task object. This function provided as a convenience is available in the top-level ClusterShell.Task package namespace.

task_cleanup()

source code 

Cleanup routine to destroy all created tasks. This function provided as a convenience is available in the top-level ClusterShell.Task package namespace.