How Get Jobs and Stop Jobs activities work

Hello dear forum
Let me give you some context on the problem. I have a process that should check if a certain job is running, “ProcessA”, and according to some conditions (which are not relevant here) it should stop the orchestrator execution. Questions:

  1. How does the filter of the Get Jobs activity work, I want the condition to be “Process name =‘ProcessA’ And state = ‘Running’”.
  2. For the Stop Job activity how should the input variable be? I know it has to be type OrchestratorJob, but how do I write it if I want to stop ProcessA?

@jrmp

  1. In get Jobs use this filter "State eq 'Running' and ReleaseName eq 'NameOfProcess'"
  2. Output of get jobs is list of jobs…you can pass the output as listofjobs(0) to get the first matched matched job to stop using stop activity

cheers

Hi @jrmp

In the “Get Jobs” activity, use the “Filter” property to specify your conditions. For your case, you want to filter jobs where the process name is ‘ProcessA’ and the state is ‘Running’. You can set the filter like this:

“State eq ‘Running’ and ProcessName eq ‘ProcessA’”

This filter expression will retrieve jobs that match the specified conditions.

Use a “For Each” activity to loop through the filtered jobs obtained from the “Get Jobs” activity. In each iteration, you will have access to one job that matches the condition.

  • Inside the “For Each” loop, use the “Stop Job” activity to stop the current job.
  • Set the “Job” property of the “Stop Job” activity to the current job you are iterating over.

Thanks!!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.