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