Gathering Data with a TaskManager Interface

TaskManager is a service interface that you can also use for accessing and manipulating Task objects. This approach uses a PropertyCollector that includes the recentTask property of the TaskManager managed object that corresponds to the Recent Tasks pane at the bottom of the vSphere client User Interface.

You can use the following TaskManager properties in your client application.

  • descriptionTaskDescription object that includes a methodInfo property. methodInfo contains a key-based array that TaskManager uses to populate the value of a TaskInfo data object’s descriptionId property with the name of the operation. Examples of two elements from this key-based array are methodInfo["Folder.createVm"] and methodInfo["Folder.createClusterEx"].
  • recentTask – Array of Task managed object references that are queued to run, running, or completed within the past 10 minutes. On ESX/ESXi hosts that are managed by a vCenter Server, a completed task must also be one of the 200 most recent tasks to be included in the array. A vSphere Client connected to a vSphere Server displays queued, running, and completed tasks in the Recent Tasks pane.

In addition to these properties, TaskManager has the following methods:

  • CreateTask – Used by other methods to create a custom Task object. Developers creating extensions can use this method to create custom Task objects.
  • CreateCollectorForTasks – Creates an object that contains all tasks from the vCenter Server database that meet specific criteria. You cannot run this method against an ESX/ESXi system. See Using a TaskHistoryCollector.

TaskManager and Task Managed Objects shows a UML class diagram for TaskManager and associated objects.

Figure 1. TaskManager and Task Managed Objects
Shows Task Manager with Task object, Description, and Task Info.