Description
The status wrapper script should check the execution status of the DRM jobs identified by the IDs given. 3DOrchestrate writes the command arguments and command output to the 3DOrchestrate Distribution Server log file.
DescriptionThe status wrapper script should check the execution status of the DRM jobs identified by the IDs given. 3DOrchestrate writes the command arguments and command output to the 3DOrchestrate Distribution Server log file. Syntax<statusPath> drmjobid1 ... drmjobidn where:
For example: bjobs.pl ID1 ID2 ID3 ID4 ReturnThe status script should return JavaScript Object Notation (JSON) in the following format: [ {drmjobid:"<DRM_JOB_ID>",jobstatus:"<DRM_JOB_STATUS>",message:"<MESSAGE>"}, {drmjobid:"<DRM_JOB_ID>",jobstatus:"<DRM_JOB_STATUS>",message:"<MESSAGE>"}, ... {drmjobid:"<DRM_JOB_ID>",jobstatus:"<DRM_JOB_STATUS>",message:"<MESSAGE>"} ] where:
3DOrchestrate logs the DRM job status in the 3DOrchestrate Distribution Server log file. ExampleAn example Perl script for the status command for IBM Spectrum LSF is shown below. #!/usr/local/perl/bin/perl ##!/usr/bin/env perl # #SCRIPT ARGUMENTS: # $0 drmjobid1 ... drmjobidN # #DEBUG OUTPUT: # written to catalina.out when fiper.system.<DRM_NAME>.debugLog=true # #SCRIPT OUTPUT # # JSON: # [ # { drmjobid: "<DRM_JOB_ID>", jobstatus:"<DRM_JOB_STATUS>", message: "<MESSAGE>" }, # { drmjobid: "<DRM_JOB_ID>", jobstatus:"<DRM_JOB_STATUS>", message: "<MESSAGE>" }, # { drmjobid: "<DRM_JOB_ID>", jobstatus:"<DRM_JOB_STATUS>", message: "<MESSAGE>" } # ] # where: # <DRM_JOB_ID> = DRM Job ID # <DRM_JOB_STATUS> = DRM Job Status, Status could be any of the following: # RUNNING # PENDING # SUSPENDED # ABORTED # CANCELLED # UNKNOWN # FINISHED # <MESSAGE> = DRM message use strict; use JSON; my %jobInfo; open(BJOBS, "bjobs -UF @ARGV 2>&1 |"); while(<BJOBS>) { chomp; if (/Job\s+\<(\d+)\>.*Status\s+\<(\w+)\>/) { my $jobID = $1; my $jobStatus = $2; if ($jobStatus eq "RUN") { $jobStatus = "RUNNING"; } elsif ($jobStatus eq "PEND") { $jobStatus = "PENDING"; } elsif ($jobStatus =~ /SUSP/) { $jobStatus = "SUSPENDED"; } elsif ($jobStatus =~ /EXIT/) { $jobStatus = "ABORTED"; } else { $jobStatus = "UNKNOWN"; } $jobInfo{$jobID}{'drmjobid'} = $jobID; $jobInfo{$jobID}{'jobstatus'} = "$jobStatus"; $jobInfo{$jobID}{'message'} = "Job $jobID is $jobStatus."; } elsif (/Job\s+\<(\d+)\>\s+is\s+not\s+found/) { my $jobID = $1; $jobInfo{$jobID}{'drmjobid'} = $jobID; $jobInfo{$jobID}{'jobstatus'} = "UNKNOWN"; $jobInfo{$jobID}{'message'} = "Job $jobID is not found."; } } close BJOBS; my $json = "\["; foreach my $id (keys %jobInfo) { $json .= to_json \%{$jobInfo{$id}}; $json .= ","; } $json =~ s/\,$//; $json .= "\]"; print "$json\n"; exit 0; |