Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How can I get the PID for the current process running?

Hi,
How can I get the PID of the current job running?? Is there an existing global variable?
Labels (2)
5 Replies
Anonymous
Not applicable
Author

Hi,
I have the same need : Does anyone know how it is possible to retrieve the PID of the current job ?
(The PID that we can find in the statistics and logs tables ; Fields PID, ROOT_PID...)
Thx
_AnonymousUser
Specialist III
Specialist III

You can get the job's pid by:
java.lang.management.ManagementFactory.getRuntimeMXBean().getName().split("@");

ugly, but works.
Anonymous
Not applicable
Author

Thanks for your answer.
It seems that your code returns the system_pid.
This system_pid is present in the statistics table but not in the logs table. It's different from the field PID of these tables.
However, if there isn't a better method to retrieve this PID, i can retrieve it with the system_pid and a join between the statistics table and the logs table.
josephmundadan
Contributor
Contributor

You can get the job's pid by:
java.lang.management.ManagementFactory.getRuntimeMXBean().getName().split("@");

ugly, but works.

Thanks for the info. It worked.
Anonymous
Not applicable
Author

hi Foldi Tamas,
Kindly explain me where I can write this and how to use this to get PID.
And also tell me where can I see the output.

Code:
java.lang.management.ManagementFactory.getRuntimeMXBean().getName().split("@");

Thanks,
Satya.