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: 
talendstar
Creator
Creator

Find and Kill PID of Process

I have developed a job in Talend studio that runs a windows Batch file using tSystem component.

 

The batch file kicks off a R script. I can see this R process in Windows task manager once the batch is executed.

 

At times when I have to kill the job from Studio or even from TMC the R script kicked off by windows batch keeps running even though the parent job has been killed.

 

Is there a way to find the PID from within Talend Studio and kill the R process as part of a job flow. I have a timeout context variable, which if not set after 1 hour will be used in tjava to kill the job, however the problem is that even if the job is killed - the R script will keep running - unless I can obtain the PID of this within the job flow and execute a taskkill command as part of the job flow.

 

I can run the following command to kill the executable:

taskkill /IM Rscript.exe /F

 

However the problem with this approach is that there may be other jobs running in parallel that may also be executing scripts using Rscript.exe .

 

How can I cleanly identify the PID and then kill it as part of the flow.

 

Thanks

Labels (1)
3 Replies
Anonymous
Not applicable

Hi,

 

    You will have to list the processed ids based on your user name and from that process id, pick the id which is having R script in the name.

 

    If you are looking for different options available to see the task list, please refer the below link.

 

https://jpsoft.com/help/tasklist.htm

 

    Once the Windows script is created, you can call them from tSystem component like any other command. Before initiating the kill command, please double check the process ids by printing them in the test flows.

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

talendstar
Creator
Creator
Author

What if you have multiple processes running but you want to kill only one of them. For example I have multiple jobs that run an executable via tsystem and I want to kill the executable for only one job. How can I identify which executable maps to which Talend flow?
Anonymous
Not applicable

Hi,

 

    Could you please try the details given in below link?

 

https://serverfault.com/questions/126502/how-to-get-own-process-pid-from-the-command-prompt-in-windo...

 

     Personally I have not tried it but it seems to have up votes.

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂