Files
deb-python-pyvmomi/docs/vim/Task.rst
Shawn Hartsock 15f7be9a52 pyVmomi reStructured Text Documentation
This external documentation for pyVmomi was generated using Googly Docs
(aka Google Standard Documentation) which renders very cleanly in
GitHub. Internal documentation for a class should be done in Sphinx
format because tools like pyCharm and Eclipse can use that documentation
as a hint for code completion.

Note: External docs as Googly Docs, internal docs as Sphinx.

Closes bug#15
2014-06-17 14:07:42 -04:00

3.4 KiB

vim.Task

A task is used to monitor and potentially cancel long running operations.

extends

vim.ExtensibleManagedObject

Attributes

info (vim.TaskInfo):

Detailed information about this task.

Methods

CancelTask():

Cancels a running or queued task. A task may only be canceled if it is cancelable. Multiple cancel requests will be treated as a single cancelation request. Canceling a completed or already canceled task will throw an InvalidState exception.If a task is canceled, its runtime state will be set to error and its error state will be set to RequestCanceled .A cancel operation is asynchronous. The operation may return before the task is canceled.

Privilege:

Global.CancelTask

Args:

Returns:

None

Raises:

vim.fault.InvalidState:

If the task is already canceled or completed.

vmodl.fault.NotSupported:

If the task is not cancelable.

UpdateProgress(percentDone):

Sets percentage done for this task and recalculates overall percentage done. If a percentDone value of less than zero or greater than 100 is specified, a value of zero or 100 respectively is used. since: VI API 2.5

Privilege:

Task.Update

Args:
percentDone (int):

Percentage to set for this task

Returns:

None

Raises:

vim.fault.InvalidState:

If task is not running

vim.fault.OutOfBounds:

VirtualCenter 2.x servers throw this fault if percentDone is less than 0 or greater than 100. Newer versions behave as described above, and never throw this fault.

SetTaskState(state, result, fault):

Sets task state and optionally sets results or fault, as appropriate for state since: VI API 2.5

Privilege:

Task.Update

Args:
state (vim.TaskInfo.State):

New state for task

result (object, optional):

Result to set, valid only if task state is TaskInfo.State.success

fault (vmodl.MethodFault, optional):

Fault to set, valid only if task state is error . The fault must be a of a fault type that directly or indirectly extends VimFault .

Returns:

None

Raises:

vim.fault.InvalidState:

If attempting to change states after task is completed or in error, or attempting to set the result or fault incorrectly

SetTaskDescription(description):

Updates task description to describe the current phase of the task. since: vSphere API 4.0

Privilege:

Task.Update

Args:
description (vmodl.LocalizableMessage):

New description for task

Returns:

None