0

I have a question.

I want to run more instance of same job in parallel from within a script: I have a loop in which I invoke jobs with dsjob and without option "-wait" and "-jobstatus".

I want that jobs completed before script termination, but I don't know how to verify if job instance terminated. I though to use wait command but it is not appropriate.

Thanks in advance

crazy_prog
  • 1,085
  • 5
  • 19
  • 34
sangi
  • 511
  • 3
  • 13
  • 25

3 Answers3

2

First,you should assure job compile option "Allow Multiple Instance" choose.

Second:

#!/bin/bash
. /home/dsadm/.bash_profile

INVOCATION=(1 2 3 4 5)

cd $DSHOME/bin
for id in ${INVOCATION[@]}
do
        ./dsjob -run -mode NORMAL -wait test demo.$id
done

project -- test

job -- demo

$id -- invocation id

the two line in shell scipt:guarantee the environment path can work.

gobird
  • 81
  • 1
  • 7
0

Run the jobs like you say without the -wait, and then loop around running dsjob -jobinfo and parse the output for a job status of 1 or 2. When all jobs return this status, they are all finished.

You might find, though, that you check the status of the job before it actually starts running and you might pick up an old status. You might be able to fix this by first resetting the job instance and waiting for a status of "Not running", prior to running the job.

PhilHibbs
  • 859
  • 1
  • 13
  • 30
0
  • Invoke the jobs in loop without wait or job-status option

  • after your loop , check the jobs status by dsjob command

Example - dsjob -jobinfo projectname jobname.invocationid

  • you can code one more loop for this also and use sleep command under that

  • write yours further logic as per status of the jobs

but its good to create Job Sequence to invoke this multi-instance job simultaneously with the help of different invoaction-ids

  • create a sequence job if these are in same process

  • create different sequences or directly create different scripts to trigger these jobs simultaneously with invocation- ids and schedule in same time.

Best option create a standard generalized script where each thing will be getting created or getting value as per input command line parameters

Example - log files on the basis of jobname + invocation-id

then schedule the same script for different parameters or invocations .