VMware {code} Community
Anandraj
Contributor
Contributor
Jump to solution

How to get all read all the Taskinfo thru TaskHistoryCollector...

Hi...

I trying to get the recent TaskInfo of a Vm thru TaskManger...

The issues is I get only last 10 task... how can i get the other tasks...

the code ...

TaskFilterSpecByEntity espec=new TaskFilterSpecbyEntity();

espec.entity=_VmRef;

espec.recursion=self;

TaskFilterSpec taskfilter=new TaskFilterSpec();

taskfilter.entity=entitySpec;

ManagedObjectReference TaskManager=sic.taskManager();

ManagedObjectReference taskHistoryCollector=service.CreateCollectorForTasks(_TaskManager,taskFilter);

TaskInfo[] tskProp=(TaskInfo[])getProperties(_taskHistoryCollector,"latestPage");

Here tskProp is having the TaskInfo of last 10 tasks... How can i get the Navigate to Next set of tasks...

I came to know using these events ReadNextTasks , ReadPreviousTasks... but i could figure it out how to get these...

how to get the events of the ManagedObjetReference.. here _taskHistoryCollector object...

Thanks...

Reply
0 Kudos
1 Solution

Accepted Solutions
ssurana
VMware Employee
VMware Employee
Jump to solution

yes, you are right..

for java and C# you would need to call the methods in this way.

_service.method(params);

View solution in original post

Reply
0 Kudos
5 Replies
ssurana
VMware Employee
VMware Employee
Jump to solution

Hi Anand,

You can use the below commands for navigating through the list of tasks.

ManagedObjectReference taskHistoryCollector =service.CreateCollectorForTasks(_TaskManager,taskFilter);

TaskInfo[] tasks = service.ReadNextTasks(taskHistoryCollector, 10); # for reading the next 10 tasks

TaskInfo[] tasks = service.ReadPreviousTasks(taskHistoryCollector, 10); # for reading the previous 10 tasks

service.ResetCollector(taskHistoryCollector); # Moves the "scrollable view" to the item immediately preceding the "viewable latest page"

service.RewindCollector(taskHistoryCollector); # Moves the "scrollable view" to the oldest item. If you use ReadNextTasks or ReadNextEvents, all items are retrieved from the oldest item to the newest item.

Also please refer to the API documentation for these methods to get more details about them

Hope the above helps

~ Sidharth

Anandraj
Contributor
Contributor
Jump to solution

hey got it... Thanks Sidharth...

How Usually we call the meathods of ManagedObjectReference...

Is it always with the help of service something like...

_service.method(params);

Anand.

Reply
0 Kudos
ssurana
VMware Employee
VMware Employee
Jump to solution

yes, you are right..

for java and C# you would need to call the methods in this way.

_service.method(params);

Reply
0 Kudos
Anandraj
Contributor
Contributor
Jump to solution

Got it... Thanks...

Anand.

Reply
0 Kudos
Anandraj
Contributor
Contributor
Jump to solution

Hi,

Is there any way to get the taskinfo based on the task-Key... Now i'm getting all the taskinfo of a particular Vm..

thru TaskHistoryCollector and itreating thru the task and based on the Key i'm getting the state of a particular task...

I just want to know is there some thing like filter to retrieve a particular task... service.createtaskcollector(taskmanger,filter)...

Anand..

Reply
0 Kudos