1 |
slacapra |
1.1 |
from Submitter import Submitter
|
2 |
|
|
import common
|
3 |
|
|
from crab_util import *
|
4 |
|
|
|
5 |
|
|
class Resubmitter(Submitter):
|
6 |
|
|
def __init__(self, cfg_params, jobs, UseServer=0):
|
7 |
|
|
nj_list = []
|
8 |
|
|
for nj in jobs:
|
9 |
|
|
st = common.jobDB.status(int(nj)-1)
|
10 |
|
|
if st in ['K','A']:
|
11 |
|
|
nj_list.append(int(nj)-1)
|
12 |
|
|
common.jobDB.setStatus(int(nj)-1,'C')
|
13 |
|
|
elif st == 'Y':
|
14 |
|
|
common.scheduler.moveOutput(nj)
|
15 |
|
|
nj_list.append(int(nj)-1)
|
16 |
|
|
st = common.jobDB.setStatus(int(nj)-1,'RC')
|
17 |
|
|
elif st in ['C','X']:
|
18 |
|
|
common.logger.message('Job #'+`int(nj)`+' has status '+crabJobStatusToString(st)+' not yet submitted!!!')
|
19 |
|
|
pass
|
20 |
|
|
elif st == 'D':
|
21 |
|
|
common.logger.message('Job #'+`int(nj)`+' has status '+crabJobStatusToString(st)+' must be retrieved before resubmission')
|
22 |
|
|
else:
|
23 |
|
|
common.logger.message('Job #'+`nj`+' has status '+crabJobStatusToString(st)+' must be "killed" before resubmission')
|
24 |
|
|
pass
|
25 |
|
|
|
26 |
|
|
|
27 |
|
|
if len(nj_list) != 0:
|
28 |
|
|
nj_list.sort()
|
29 |
|
|
|
30 |
|
|
# remove job ids from the submission history file (for the server) # Fabio
|
31 |
|
|
if (UseServer == 1):
|
32 |
|
|
file = open(common.work_space.shareDir()+'/submit_directive','r')
|
33 |
|
|
prev_subms = str(file.readlines()[0]).split('\n')[0]
|
34 |
|
|
file.close()
|
35 |
|
|
|
36 |
|
|
new_subms = []
|
37 |
|
|
if prev_subms != 'all':
|
38 |
|
|
# remove the jobs in nj_list from the history
|
39 |
|
|
new_subms = [ j for j in eval(prev_subms) not in nj_list ]
|
40 |
|
|
|
41 |
|
|
file = open(common.work_space.shareDir()+'/submit_directive','w')
|
42 |
|
|
file.write(str(new_subms))
|
43 |
|
|
file.close()
|
44 |
|
|
pass
|
45 |
|
|
pass
|
46 |
|
|
Submitter.__init__(self, cfg_params, nj_list, 'range')
|
47 |
|
|
pass
|