2 |
|
from SchedulerLocal import SchedulerLocal |
3 |
|
from crab_exceptions import * |
4 |
|
from crab_util import * |
5 |
– |
from crab_logger import Logger |
5 |
|
import common |
6 |
+ |
from LFNBaseName import * |
7 |
|
|
8 |
|
import os,string |
9 |
|
|
17 |
|
|
18 |
|
def __init__(self): |
19 |
|
Scheduler.__init__(self,"LSF") |
20 |
< |
|
20 |
> |
|
21 |
|
return |
22 |
|
|
23 |
|
def configure(self, cfg_params): |
24 |
|
SchedulerLocal.configure(self, cfg_params) |
25 |
|
self.outputDir = cfg_params.get('USER.outputdir' ,common.work_space.resDir()) |
26 |
< |
self.environment_unique_identifier = "https://"+common.scheduler.name()+":/${LSB_BATCH_JID}-"+ \ |
27 |
< |
string.replace(common._db.queryTask('name'),"_","-") |
26 |
> |
self.res = cfg_params.get(self.name().upper()+'.resource','"type==SLC5_64 || type==SLC4_64"') |
27 |
|
|
28 |
+ |
self.pool = cfg_params.get('USER.storage_pool',None) |
29 |
|
return |
30 |
|
|
31 |
+ |
def envUniqueID(self): |
32 |
+ |
id = "https://"+common.scheduler.name().upper()+":/${LSB_BATCH_JID}-"+ \ |
33 |
+ |
string.replace(common._db.queryTask('name'),"_","-") |
34 |
+ |
return id |
35 |
+ |
|
36 |
|
def realSchedParams(self,cfg_params): |
37 |
|
""" |
38 |
< |
Return dictionary with specific parameters, to use |
39 |
< |
with real scheduler |
38 |
> |
Return dictionary with specific parameters, to use |
39 |
> |
with real scheduler |
40 |
|
""" |
41 |
< |
### use by the BossLite script |
41 |
> |
### use by the BossLite script |
42 |
|
self.cpCmd = cfg_params.get(self.name().upper()+'.cp_command','cp') |
43 |
|
self.rfioName = cfg_params.get(self.name().upper()+'.rfio_server','') |
44 |
|
|
45 |
|
params = { 'cpCmd' : self.cpCmd, \ |
46 |
< |
'rfipName' : self.rfioName |
46 |
> |
'rfioName' : self.rfioName |
47 |
|
} |
48 |
|
return params |
49 |
|
|
50 |
+ |
def wsSetupEnvironment(self): |
51 |
+ |
""" |
52 |
+ |
Returns part of a job script which does scheduler-specific work. |
53 |
+ |
""" |
54 |
+ |
txt = SchedulerLocal.wsSetupEnvironment(self) |
55 |
+ |
#this is needed to support slc4->slc5 migration |
56 |
+ |
txt += 'export RFIO_PORT=5001\n' |
57 |
+ |
txt += '\n' |
58 |
+ |
return txt |
59 |
|
def sched_parameter(self,i,task): |
60 |
|
""" |
61 |
|
Returns parameter scheduler-specific, to use with BOSS . |
62 |
|
""" |
49 |
– |
index = int(common._db.nJobs()) - 1 |
63 |
|
sched_param= '' |
64 |
|
|
65 |
< |
for i in range(index): # Add loop DS |
66 |
< |
|
67 |
< |
sched_param= '' |
68 |
< |
if (self.queue): |
56 |
< |
sched_param += '-q '+self.queue +' ' |
57 |
< |
if (self.res): sched_param += ' -R '+self.res +' ' |
58 |
< |
pass |
59 |
< |
|
60 |
< |
sched_param+='-cwd '+ str(self.outputDir) + ' ' |
65 |
> |
if (self.queue): |
66 |
> |
sched_param += '-q '+self.queue +' ' |
67 |
> |
if (self.res): sched_param += ' -R '+self.res +' ' |
68 |
> |
# sched_param+='-cwd '+ str(self.outputDir) + ' ' |
69 |
|
return sched_param |
70 |
|
|
71 |
< |
def loggingInfo(self, id): |
71 |
> |
def listMatch(self, dest, full): |
72 |
> |
""" |
73 |
> |
""" |
74 |
> |
if len(dest)!=0: |
75 |
> |
sites = [self.blackWhiteListParser.cleanForBlackWhiteList(dest,'list')] |
76 |
> |
else: |
77 |
> |
sites = [str(getLocalDomain(self))] |
78 |
> |
return sites |
79 |
> |
|
80 |
> |
def loggingInfo(self, id, fname): |
81 |
|
""" return logging info about job nj """ |
82 |
< |
cmd = 'bjobs -l ' + id |
82 |
> |
lsfid = common._db.queryRunJob('schedulerId',id) |
83 |
> |
cmd = 'bjobs -l ' + str(lsfid[0]) |
84 |
|
cmd_out = runCommand(cmd) |
85 |
< |
return cmd_out |
85 |
> |
f = open(fname,'w') |
86 |
> |
f.write(cmd_out) |
87 |
> |
f.close() |
88 |
> |
return fname |
89 |
> |
|
90 |
> |
def wsCopyOutput(self): |
91 |
> |
txt=self.wsCopyOutput_comm(self.pool) |
92 |
> |
return txt |
93 |
|
|
94 |
|
def wsExitFunc(self): |
95 |
|
""" |
101 |
|
txt += '#\n\n' |
102 |
|
|
103 |
|
txt += 'func_exit() { \n' |
104 |
< |
txt += self.wsExitFunc_common() |
104 |
> |
txt += SchedulerLocal.wsExitFunc_common(self) |
105 |
|
|
106 |
|
txt += ' cp *.${LSB_BATCH_JID}.out CMSSW_${NJob}.stdout \n' |
107 |
|
txt += ' cp *.${LSB_BATCH_JID}.err CMSSW_${NJob}.stderr \n' |
110 |
|
txt += '}\n' |
111 |
|
|
112 |
|
return txt |
88 |
– |
|