5.6. Workflow job¶
See also
Workflow jobs are not exactly job types, but a way for users to control the submission of multiple jobs using shell scripts.
5.6.1. Job submission¶
In workflow jobs, the user submits the job with a shell script.
- Waiting for job completion
You can wait for the end of one or more jobs in a shell script with using pjwait command.
- Get job execution results
You can obtain the job end code (job manager processing result), job script end status, and signal number when the job script ends with using pjwait command.
The following is a workflow job flow diagram.

When this workflow job is described in a shell script, it will be as follows.
#!/bin/sh
for no in 1 2 3 # Put in order job script job1.sh, job2.sh, job3.sh
do
JID=`pjsub -z jid job${no}.sh` # Display job ID with -z option and assign to shell variable JID
if [ $? -ne 0 ]; then # If the job submission result is other than 0, the workflow job ends
exit 1
fi
set -- `pjwait $JID` # Wait for the job to finish and assign the output result to the position parameter (Note)
if [ $2 != "0" -o $3 != "0" ]; then # If either the job exit code ($ 2) or the job script exit status ($ 3) is not 0,
exit 1 # the workflow job is terminated.
fi
done # Go to execute next job
Attention
Depending on the type of job and how to specify the job ID, the output result may be multiple lines so arrangement is needed. About output, refer to man manual of pjwait command.