Using TaskInfo to Determine Task Status

A Task object provides information about the status of the invoked operation through its TaskInfo data object. An instance of TaskInfo populates the info property of the Task managed object at runtime. By monitoring properties of the TaskInfo object, a client application can take appropriate action when the Task completes, or can handle errors if the Task does not complete successfully.

The Task.info property contains a TaskInfo data object that contains information about the Task the server returns to your client application.

When a Task is instantiated by the server, the TaskInfo.result property is initialized to Unset. Upon successful completion of an operation, the result property is populated with the return type specific to the operation. The result might be a data object, a reference to a managed object, or any other data structure as defined by the operation.

For example:

  1. The ClusterComputeResource.AddHost_Task method returns a Task object whose info property contains a TaskInfo data object.
  2. At the start of the operation, the result property is Unset.
  3. Upon successful completion of the operation, the result property of TaskInfo contains the managed object reference of the newly added HostSystem.