newTask
Create new a BeeCluster task.
handler = session.newTask(
func,
*argv,
TaskName = None,
SameDrone=False,
NonInterruptible = False,
callback_handler = None,
error_handler = None,
timeout = None
)
Parameters
| Name | Description |
|---|---|
| func | The task function. |
| *argv | Arguments of the task function. |
| TaskName | The name of the function. If this field is None, the name of the task will be the name of the task function. |
| SameDrone | The SameDrone binding flag. |
| NonInterruptible | The NonInterruptible binding flag. |
| callback_handler | When the task is completed, BeeCluster runtime calls the callback_handler. There is one passed-in parameter which is the result of the task. |
| error_handler | When an error occurrs, BeeCluster runtime calls the error_handler with one passed-in parameter which is the error type. |
| timeout | A number indicate the timeout. The unit is second. When timed out, BeeCluster runtime calls the error_handler. |
Return
Return an Task object as the task handler.
Remark
This function call is non-blocking. Blocking happens when the execution result of the task is retrieved from the action handler or calling wait() on the task handler explicitly.
- handler.val Retrieve the execution result of a task from its handler (blocking)
- handler.wait() Wait until the task is completed (blocking)