@@ -194,7 +194,7 @@ def __init__(self, jobID=None, jobReport=None):
194
194
#############################################################################
195
195
def initialize (self , arguments ):
196
196
"""Initializes parameters and environment for job."""
197
- self .__report (status = JobStatus .RUNNING , minorStatus = JobMinorStatus .JOB_INITIALIZATION )
197
+ self .__report (status = JobStatus .RUNNING , minorStatus = JobMinorStatus .JOB_INITIALIZATION , sendFlag = True )
198
198
self .log .info ("Starting Job Wrapper Initialization for Job" , self .jobID )
199
199
self .jobArgs = arguments ["Job" ]
200
200
self .log .verbose (self .jobArgs )
@@ -371,8 +371,8 @@ def execute(self):
371
371
self .log .verbose ("%s = %s" % (nameEnv , valEnv ))
372
372
373
373
if os .path .exists (executable ):
374
- # it's in fact not yet running: it will be in few lines
375
- self .__report (status = JobStatus . RUNNING , minorStatus = JobMinorStatus .APPLICATION , sendFlag = True )
374
+ # the actual executable is not yet running: it will be in few lines
375
+ self .__report (minorStatus = JobMinorStatus .APPLICATION , sendFlag = True )
376
376
spObject = Subprocess (timeout = False , bufferLimit = int (self .bufferLimit ))
377
377
command = executable
378
378
if jobArguments :
@@ -482,9 +482,7 @@ def execute(self):
482
482
self .__report (status = JobStatus .COMPLETING , minorStatus = JobMinorStatus .APP_ERRORS , sendFlag = True )
483
483
if status in (DErrno .EWMSRESC , DErrno .EWMSRESC & 255 ): # the status will be truncated to 0xDE (222)
484
484
self .log .verbose ("job will be rescheduled" )
485
- self .__report (
486
- status = JobStatus .COMPLETING , minorStatus = JobMinorStatus .GOING_RESCHEDULE , sendFlag = True
487
- )
485
+ self .__report (minorStatus = JobMinorStatus .GOING_RESCHEDULE , sendFlag = True )
488
486
return S_ERROR (DErrno .EWMSRESC , "Job will be rescheduled" )
489
487
490
488
else :
@@ -564,7 +562,9 @@ def __getCPUHMS(self, cpuTime):
564
562
#############################################################################
565
563
def resolveInputData (self ):
566
564
"""Input data is resolved here using a VO specific plugin module."""
567
- self .__report (status = JobStatus .RUNNING , minorStatus = JobMinorStatus .INPUT_DATA_RESOLUTION , sendFlag = True )
565
+ self .__report (
566
+ minorStatus = JobMinorStatus .INPUT_DATA_RESOLUTION , sendFlag = True
567
+ ) # if we are here, the status should be "Running"
568
568
569
569
# What is this input data? - and exit if there's no input
570
570
inputData = self .jobArgs ["InputData" ]
@@ -899,7 +899,7 @@ def __resolveOutputSandboxFiles(self, outputSandbox):
899
899
def __transferOutputDataFiles (self , outputData , outputSE , outputPath ):
900
900
"""Performs the upload and registration in the File Catalog(s)"""
901
901
self .log .verbose ("Uploading output data files" )
902
- self .__report (status = JobStatus . COMPLETING , minorStatus = JobMinorStatus .UPLOADING_OUTPUT_DATA )
902
+ self .__report (minorStatus = JobMinorStatus .UPLOADING_OUTPUT_DATA ) # the major status should be "Completing"
903
903
self .log .info ("Output data files %s to be uploaded to %s SE" % (", " .join (outputData ), outputSE ))
904
904
missing = []
905
905
uploaded = []
@@ -1091,7 +1091,7 @@ def transferInputSandbox(self, inputSandbox):
1091
1091
sandboxFiles = []
1092
1092
registeredISB = []
1093
1093
lfns = []
1094
- self .__report (status = JobStatus . RUNNING , minorStatus = JobMinorStatus .DOWNLOADING_INPUT_SANDBOX )
1094
+ self .__report (minorStatus = JobMinorStatus .DOWNLOADING_INPUT_SANDBOX ) # Should be in "Running" status
1095
1095
if not isinstance (inputSandbox , (list , tuple )):
1096
1096
inputSandbox = [inputSandbox ]
1097
1097
for isb in inputSandbox :
@@ -1118,21 +1118,19 @@ def transferInputSandbox(self, inputSandbox):
1118
1118
self .log .info ("Downloading Input SandBox %s" % isb )
1119
1119
result = SandboxStoreClient ().downloadSandbox (isb )
1120
1120
if not result ["OK" ]:
1121
- self .__report (
1122
- status = JobStatus .RUNNING , minorStatus = JobMinorStatus .FAILED_DOWNLOADING_INPUT_SANDBOX
1123
- )
1121
+ self .__report (minorStatus = JobMinorStatus .FAILED_DOWNLOADING_INPUT_SANDBOX )
1124
1122
return S_ERROR ("Cannot download Input sandbox %s: %s" % (isb , result ["Message" ]))
1125
1123
else :
1126
1124
self .inputSandboxSize += result ["Value" ]
1127
1125
1128
1126
if lfns :
1129
1127
self .log .info ("Downloading Input SandBox LFNs, number of files to get" , len (lfns ))
1130
- self .__report (status = JobStatus . RUNNING , minorStatus = JobMinorStatus .DOWNLOADING_INPUT_SANDBOX_LFN )
1128
+ self .__report (minorStatus = JobMinorStatus .DOWNLOADING_INPUT_SANDBOX_LFN )
1131
1129
lfns = [fname .replace ("LFN:" , "" ).replace ("lfn:" , "" ) for fname in lfns ]
1132
1130
download = self .dm .getFile (lfns )
1133
1131
if not download ["OK" ]:
1134
1132
self .log .warn (download )
1135
- self .__report (status = JobStatus . RUNNING , minorStatus = JobMinorStatus .FAILED_DOWNLOADING_INPUT_SANDBOX_LFN )
1133
+ self .__report (minorStatus = JobMinorStatus .FAILED_DOWNLOADING_INPUT_SANDBOX_LFN )
1136
1134
return S_ERROR (download ["Message" ])
1137
1135
failed = download ["Value" ]["Failed" ]
1138
1136
if failed :
@@ -1303,16 +1301,6 @@ def sendFailoverRequest(self):
1303
1301
request .JobID = self .jobID
1304
1302
request .SourceComponent = "Job_%s" % self .jobID
1305
1303
1306
- # JobReport part first
1307
- result = self .jobReport .generateForwardDISET ()
1308
- if result ["OK" ]:
1309
- if isinstance (result ["Value" ], Operation ):
1310
- self .log .info ("Adding a job state update DISET operation to the request" )
1311
- request .addOperation (result ["Value" ])
1312
- else :
1313
- self .log .warn ("JobReportFailure" , "Could not generate a forwardDISET operation: %s" % result ["Message" ])
1314
- self .log .warn ("JobReportFailure" , "The job won't fail, but the jobLogging info might be incomplete" )
1315
-
1316
1304
# Failover transfer requests
1317
1305
for storedOperation in self .failoverTransfer .request :
1318
1306
request .addOperation (storedOperation )
@@ -1325,6 +1313,16 @@ def sendFailoverRequest(self):
1325
1313
for storedOperation in requestStored :
1326
1314
request .addOperation (storedOperation )
1327
1315
1316
+ # JobReport part
1317
+ result = self .jobReport .generateForwardDISET ()
1318
+ if result ["OK" ]:
1319
+ if isinstance (result ["Value" ], Operation ):
1320
+ self .log .info ("Adding a job state update DISET operation to the request" )
1321
+ request .addOperation (result ["Value" ])
1322
+ else :
1323
+ self .log .warn ("JobReportFailure" , "Could not generate a forwardDISET operation: %s" % result ["Message" ])
1324
+ self .log .warn ("JobReportFailure" , "The job won't fail, but the jobLogging info might be incomplete" )
1325
+
1328
1326
if len (request ):
1329
1327
# The request is ready, send it now
1330
1328
isValid = RequestValidator ().validate (request )
0 commit comments