@@ -39,6 +39,13 @@ def __init__(self, **kwargs):
39
39
super (SGEGraphPlugin , self ).__init__ (** kwargs )
40
40
41
41
def _submit_graph (self , pyfiles , dependencies , nodes ):
42
+ def make_job_name (jobnumber , nodeslist ):
43
+ """
44
+ - jobnumber: The index number of the job to create
45
+ - nodeslist: The name of the node being processed
46
+ - return: A string representing this job to be displayed by SGE
47
+ """
48
+ return 'j{0}_{1}' .format (jobnumber , nodeslist [jobnumber ]._id )
42
49
batch_dir , _ = os .path .split (pyfiles [0 ])
43
50
submitjobsfile = os .path .join (batch_dir , 'submit_jobs.sh' )
44
51
with open (submitjobsfile , 'wt' ) as fp :
@@ -65,20 +72,20 @@ def _submit_graph(self, pyfiles, dependencies, nodes):
65
72
if idx in dependencies :
66
73
values = ' '
67
74
for jobid in dependencies [idx ]:
68
- values += '${job%05d},' % jobid
75
+ values += make_job_name ( jobid , nodes )
69
76
if values != ' ' : # i.e. if some jobs were added to dependency list
70
77
values = values .rstrip (',' )
71
78
deps = '-hold_jid%s' % values
72
- jobname = 'job%05d' % (idx )
73
- ## Do not use default output locations if they are set in self._qsub_args
79
+ jobname = make_job_name (idx , nodes )
80
+ # Do not use default output locations if they are set in self._qsub_args
74
81
stderrFile = ''
75
82
if self ._qsub_args .count ('-e ' ) == 0 :
76
- stderrFile = '-e {errFile}' .format (
77
- errFile = batchscripterrfile )
83
+ stderrFile = '-e {errFile}' .format (
84
+ errFile = batchscripterrfile )
78
85
stdoutFile = ''
79
86
if self ._qsub_args .count ('-o ' ) == 0 :
80
- stdoutFile = '-o {outFile}' .format (
81
- outFile = batchscriptoutfile )
87
+ stdoutFile = '-o {outFile}' .format (
88
+ outFile = batchscriptoutfile )
82
89
full_line = '{jobNm}=$(qsub {outFileOption} {errFileOption} {extraQSubArgs} {dependantIndex} -N {jobNm} {batchscript} | awk \' {{print $3}}\' )\n ' .format (
83
90
jobNm = jobname ,
84
91
outFileOption = stdoutFile ,
0 commit comments