Skip to content
This repository was archived by the owner on Nov 9, 2020. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions pyvmomi_tools/extensions/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,23 +183,23 @@ def poll_task(task, *args, **kwargs):
===============

code::
rename_task.wait()
rename_task.poll()

The main python process will block until the task completes on vSphere
the datastore object will be updated automatically with the new name.

use with sleep_seconds
======================
code::
rename_task.wait(sleep_seconds=0)
rename_task.poll(sleep_seconds=0)

The default sleep_seconds is 1, meaning the vCenter server is polled at
most 1 time every 1 second. If you set sleep_seconds to 0, the vCenter
server will be polled as fast as possible. This has the tendency to create
a great deal of network traffic.

code::
rename_task.wait(sleep_seconds=3)
rename_task.poll(sleep_seconds=3)

The process will wait 3 seconds between polling vCenter for task status.
The default is to wait 1 second between polling vCenter for task updates.
Expand All @@ -213,7 +213,7 @@ def poll_task(task, *args, **kwargs):
def output(task, state, *args):
print state

rename_task.wait(queued=output,
rename_task.poll(queued=output,
running=output,
success=output,
error=output)
Expand All @@ -230,7 +230,7 @@ def output(task, state, *args):
def output(task):
print task.info.state

rename_task.wait(sleep_seconds=3,
rename_task.poll(sleep_seconds=3,
queued=output,
running=output,
success=output,
Expand All @@ -246,7 +246,7 @@ def check_for_question(task, virtual_machine):
if virtual_machine.runtime.question:
handle_vm_question(virtual_machine)

power_on_task.wait(virtual_machine, periodic=check_for_question)
power_on_task.poll(virtual_machine, periodic=check_for_question)

You may have a situation where you need to periodically poll the state of
another object which might block your task's completion. An example of
Expand Down