cancel
Showing results for 
Search instead for 
Did you mean: 

Running the jobs sequentially instead of parallel

Former Member
0 Kudos

Hi All,

My script runs multiple jobs by iterating in a loop one by one. They are getting executed in parallel where as i want them to run sequentially one only after another has finished execution. For ensuring this i have added this logic in my code:

[Code for Job name reading, parameters setting goes here]

jcsSession.persist();

while (((infoJob.getStatus().toString().matches("Scheduled")) || (infoJob.getStatus().toString().matches("Running"))) {

  jcsOut.println("infojob still running"+infoJob.getStatus().toString());

}

This should run after each job's persist statement.

Ideally the loop should end as soon as the job attains 'Error' or 'Completed' state i.e. the job ends but when i am running the script

this while loop is running infinitely thus causing an infinite loop.

Because of which the first job ends but the script does not move forward to next job.

Please help me what i am doing wrong here or if there is any other way to make the jobs run sequentially through Redwood.

Thanks,

Archana

Accepted Solutions (0)

Answers (1)

Answers (1)

h_carpenter
Active Contributor
0 Kudos

Hi Archana,

How about jcsSession.waitForJob(infoJob);

Regards,

HP

Former Member
0 Kudos

Thanks!! It worked