Trees | Indices | Help |
|
---|
|
Task to execute. May be bound to a specific thread. To create a task in a new thread: task = Task() To create or get the instance of the task associated with the thread object thr (threading.Thread): task = Task(thread=thr) Add command to execute locally in task with: task.shell("/bin/hostname") Add command to execute in a distant node in task with: task.shell("/bin/hostname", nodes="tiger[1-20]") Run task in its associated thread (will block only if the calling thread is the associated thread: task.resume()
|
|||
_SyncMsgHandler Special task control port event handler. |
|||
tasksyncmethod Class encapsulating a function that checks if the calling task is running or is the current task, and allowing it to be used as a decorator making the wrapped task method thread-safe. |
|||
_SuspendCondition Special class to manage task suspend condition. |
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from |
|
|||
|
|
|||
a new object with type S, a subtype of T |
|
|
|||
_std_default =
|
|||
_std_info =
|
|||
_tasks =
|
|||
_taskid_max = 0
|
|||
_task_lock = threading.Lock()
|
|
|||
Inherited from |
|
For task bound to a specific thread, this class acts like a "thread singleton", so new style class is used and new object are only instantiated if needed.
|
Initialize a Task, creating a new thread if needed.
|
Set task value for specified key in the dictionary "default". Users may store their own task-specific key, value pairs using this method and retrieve them with default(). Threading considerations: Unlike set_info(), when called from the task's thread or not, set_default() immediately updates the underlying dictionary in a thread-safe manner. This method doesn't wake up the engine when called. |
Set task value for a specific key information. Key, value pairs can be passed to the engine and/or workers. Users may store their own task-specific info key, value pairs using this method and retrieve them with info(). Threading considerations: Unlike set_default(), the underlying info dictionary is only modified from the task's thread. So calling set_info() from another thread leads to queueing the request for late apply (at run time) using the task dispatch port. When received, the request wakes up the engine when the task is running and the info dictionary is then updated.
|
Schedule a shell command for local or distant execution. Local usage: task.shell(command [, key=key] [, handler=handler] [, timeout=secs] [, autoclose=enable_autoclose] [, stderr=enable_stderr]) Distant usage: task.shell(command, nodes=nodeset [, handler=handler] [, timeout=secs], [, autoclose=enable_autoclose] [, strderr=enable_stderr]) |
Add an EnginePort instance to Engine (private method).
|
Remove a port from Engine (private method).
|
Create a new task port. A task port is an abstraction object to deliver messages reliably between tasks. Basic rules: A task can send messages to another task port (thread safe). A task can receive messages from an acquired port either by setting up a notification mechanism or using a polling mechanism that may block the task waiting for a message sent on the port. A port can be acquired by one task only. If handler is set to a valid EventHandler object, the port is a send-once port, ie. a message sent to this port generates an ev_msg event notification issued the port's task. If handler is not set, the task can only receive messages on the port by calling port.msg_recv(). |
Create task's timer.
|
Schedule a worker for execution. Only useful for manually instantiated workers.
|
Resume task. If task is task_self(), workers are executed in the calling thread so this method will block until workers have finished. This is always the case for a single-threaded application (eg. which doesn't create other Task() instance than task_self()). Otherwise, the current thread doesn't block. In that case, you may then want to call task_wait() to wait for completion. |
|
Suspend task execution. This method may be called from another task (thread-safe). The function returns False if the task cannot be suspended (eg. it's not running), or returns True if the task has been successfully suspended. To resume a suspended task, use task.resume(). |
|
Abort a task. Aborting a task removes (and stops when needed) all workers. If optional parameter kill is True, the task object is unbound from the current thread, so calling task_self() creates a new Task object. |
Iterate over timed out keys (ie. nodes) for a specific worker. |
Get buffer for a specific key. When the key is associated to multiple workers, the resulting buffer will contain all workers content that may overlap. |
Get buffer for a specific key. When the key is associated to multiple workers, the resulting buffer will contain all workers content that may overlap. |
Get error buffer for a specific key. When the key is associated to multiple workers, the resulting buffer will contain all workers content that may overlap. |
Get error buffer for a specific key. When the key is associated to multiple workers, the resulting buffer will contain all workers content that may overlap. |
Return return code for a specific key. When the key is associated to multiple workers, return the max return code from these workers. |
Return return code for a specific key. When the key is associated to multiple workers, return the max return code from these workers. |
Get max return code encountered during last run. How retcodes work: If the process exits normally, the return code is its exit status. If the process is terminated by a signal, the return code is 128 + signal number. |
Iterate over buffers, returns a tuple (buffer, keys). For remote workers (Ssh), keys are list of nodes. In that case, you should use NodeSet.fromlist(keys) to get a NodeSet instance (which is more convenient and efficient): Optional parameter match_keys add filtering on these keys. Usage example: for buffer, nodelist in task.iter_buffers(): print NodeSet.fromlist(nodelist) print buffer |
Iterate over error buffers, returns a tuple (buffer, keys). See iter_buffers(). |
Iterate over return codes, returns a tuple (rc, keys). Optional parameter match_keys add filtering on these keys. How retcodes work: If the process exits normally, the return code is its exit status. If the process is terminated by a signal, the return code is 128 + signal number. |
Return the number of timed out "keys" (ie. nodes). |
Iterate over timed out keys (ie. nodes). |
Class method that blocks calling thread until all tasks have finished (from a ClusterShell point of view, for instance, their task.resume() return). It doesn't necessarly mean that associated threads have finished. |
|
_std_default
|
_std_info
|
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Tue Mar 9 10:46:34 2010 | http://epydoc.sourceforge.net |