Module Task
source code
ClusterShell Task module.
Simple example of use:
>>> from ClusterShell.Task import task_self, NodeSet
>>>
>>>
... task = task_self()
>>>
>>>
... task.shell("/bin/uname -r", nodes="tiger[1-30,35]")
<ClusterShell.Worker.Ssh.WorkerSsh object at 0x7f41da71b890>
>>>
>>>
... task.run()
>>>
>>>
... for output, nodelist in task.iter_buffers():
... print '%s: %s' % (NodeSet.fromlist(nodelist), output)
...
|
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.
|
|
Task
The Task class defines an essential ClusterShell object which aims to
execute commands in parallel and easily get their results.
|
|
_getshorthostname()
Get short hostname (host name cut at the first dot) |
source code
|
|
|
task_self(defaults=None)
Return the current Task object, corresponding to the caller's thread
of control (a Task object is always bound to a specific thread). |
source code
|
|
|
task_wait()
Suspend execution of the calling thread until all tasks terminate,
unless all tasks have already terminated. |
source code
|
|
|
|
|
|
|
__package__ = ' ClusterShell '
|
Return the current Task object, corresponding to the caller's thread
of control (a Task object is always bound to a specific thread). This
function provided as a convenience is available in the top-level
ClusterShell.Task package namespace.
|
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.
|
Destroy the Task instance bound to the current thread. A next call to
task_self() will create a new Task object. Not to be called from a signal
handler. This function provided as a convenience is available in the
top-level ClusterShell.Task package namespace.
|
Cleanup routine to destroy all created tasks. This function provided
as a convenience is available in the top-level ClusterShell.Task package
namespace. This is mainly used for testing purposes and should be avoided
otherwise. task_cleanup() may be called from any threads but not from a
signal handler.
|