-
Notifications
You must be signed in to change notification settings - Fork 406
Description
I have been trying to capture the execution time of a workflow to be able to pass it down to a file or email.
An AI bot showed me that Apache Hop managed this internal variables:
${Internal.Workflow.ExecutionDuration} Total execution time of the workflow, expressed in seconds (e.g., 306 for 5 min 6 sec) or also start/end timestamps (${Internal.Workflow.StartDateTime} / ${Internal.Workflow.EndDateTime}) .
The issue is that I always get 0 seconds as a result. Any guidance is appreciated.
I have been trying:
Add a “Dummy” transform as the last step of the workflow – it does nothing but lets you attach downstream steps.
Connect the dummy to a Calculator (or JavaScript) transform.
Inside the calculator, create three new fields:
duration_min Divide by constant ${Internal.Workflow.ExecutionDuration} / 60
duration_sec Modulo constant ${Internal.Workflow.ExecutionDuration} % 60
duration_str Concatenate ROUND(duration_min,0) + ' min ' + ROUND(duration_sec,0) + ' sec'
Now you have a string like "5 min 6 sec" stored in duration_str.
(If you prefer to keep the raw seconds, you can skip this step and just use ${Internal.Workflow.ExecutionDuration} directly.)