File: Task.rst

package info (click to toggle)
python-pyvmomi 6.7.1-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 14,984 kB
  • sloc: python: 9,206; xml: 77; makefile: 9
file content (159 lines) | stat: -rw-r--r-- 3,500 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
.. _int: https://docs.python.org/2/library/stdtypes.html

.. _object: https://docs.python.org/2/library/stdtypes.html

.. _vim.Task: ../vim/Task.rst

.. _VI API 2.5: ../vim/version.rst#vimversionversion2

.. _vim.TaskInfo: ../vim/TaskInfo.rst

.. _RequestCanceled: ../vmodl/fault/RequestCanceled.rst

.. _vSphere API 4.0: ../vim/version.rst#vimversionversion5

.. _vmodl.MethodFault: ../vmodl/MethodFault.rst

.. _vim.TaskInfo.State: ../vim/TaskInfo/State.rst

.. _vim.fault.OutOfBounds: ../vim/fault/OutOfBounds.rst

.. _vim.fault.InvalidState: ../vim/fault/InvalidState.rst

.. _vmodl.LocalizableMessage: ../vmodl/LocalizableMessage.rst

.. _vmodl.fault.NotSupported: ../vmodl/fault/NotSupported.rst

.. _vim.ExtensibleManagedObject: ../vim/ExtensibleManagedObject.rst


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