VMware {code} Community
atrockz
Contributor
Contributor

Task managing doubt

Hi all,

I am using VI SDK 2.5(java) . I have a small question on managing the task. Is there any VI SDK API which can return me a task object by its task key or name. I can get the taskmanager object which gives the list of all the just completed, running and queued tasks. I can then loop through the task list and get the required task object by comparing the key. But incase a functions already exists, then i dont need to write all these.

Thanks in advance,

0 Kudos
4 Replies
lamw
Community Manager
Community Manager

If your code is generating the task object, then you'll have a reference to it but if you're just searching for task that has ran in the past/etc. then you'll need to use the taskManager to retrieve task object AFAIK

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

If you find this information useful, please award points for "correct" or "helpful".

0 Kudos
atrockz
Contributor
Contributor

Its like, a task is already in running state and i want to get this task's information(i.e. its task object). I don't have a reference to the task object, i only have the key id of that task.

0 Kudos
admin
Immortal
Immortal

There is no API available to get the task object, passing its key or MOID. As the managed object for the task is needed only while the task is still active and

referenced by the TaskManager. Thus, the Task managed object is detached from its TaskInfo data object, so the Task object can be discarded when it’s no longer needed.

Only for managed hosts (for example, ESX or ESXi systems managed by vCenter Server), complete task history is kept in a database. You can view older tasks by creating a task history collector to select the desired tasks from the database. The specification for creating the task filter can select tasks during a specific time range, belonging to a particular user, or in a particular state. You can also limit the selection to specific alarms, entities, or scheduled tasks.

0 Kudos
atrockz
Contributor
Contributor

That kinda answer my question.

Actually i am trying to collect the information of recent tasks that has just finished, running or queued up. Incase i need to collect old task's information, i will try that "task history collecto" thingi also.

Thanks alot for your replys.

0 Kudos