Hello, I need to know the runtime of a task in a running process. I found a method to get a taskruntime in a process but it is not that easy I expected. Now my question, is there a less complicated way to get the runtime of a task? My way: It is written in the call tab of a user dialog in between 2 task symbols

ivy.log.info("Startzeit Task "+in.startTaskTime);

It is written in a script step behind the task whilst in.nummer the case nubmer is to get the last entry

TaskQuery  tazk = TaskQuery.create().where().name().isEqual("Task1Name");
Recordset taskZeit = ivy.wf.getTaskQueryExecutor().getRecordset(tazk.groupBy().endTimestamp());
ivy.log.info("TaskEndeZeit2: "+taskZeit.getColumn("ENDTIMESTAMP").get(in.nummer));

asked 19.10.2016 at 11:21

Gabriele's gravatar image

Gabriele
61668
accept rate: 66%

edited 20.10.2016 at 11:25

Reguel%20Wermelinger's gravatar image

Reguel Werme... ♦♦
8.5k21851


TaskQuery query = TaskQuery.create().where().name().isEqual("Task1Name").groupBy().endTimestamp();
ITask task = ivy.wf.getTaskQueryExecutor().getFirstResult(query) as ITask;
long taskRuntimeMillis = task.getEndTimestamp().getTime() - task.getStartTimestamp().getTime();
ivy.log.info("task runtime: "+taskRuntimeMillis);
link

answered 20.10.2016 at 11:25

Reguel%20Wermelinger's gravatar image

Reguel Werme... ♦♦
8.5k21851
accept rate: 69%

edited 20.10.2016 at 14:57

Thank's for your help, but the method "getFirstResult(query)" returns an object and I can't cast it to a type ITask.

(20.10.2016 at 14:51) Gabriele Gabriele's gravatar image

Then I guess that you are using the code in ivyScript. I've adjusted the sample with a proper ivyScript casting: as ITask

(20.10.2016 at 14:58) Reguel Werme... ♦♦ Reguel%20Wermelinger's gravatar image

Thank's a lot, now it works, I only had to cast the return value from getEndTimestamp().getTime() and getStartTimestamp().getTime to a number.

(21.10.2016 at 10:28) Gabriele Gabriele's gravatar image
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×66
×5
×2

Asked: 19.10.2016 at 11:21

Seen: 835 times

Last updated: 21.10.2016 at 10:28