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 |
|
|
27 |
+ |
self.pool = cfg_params.get('USER.storage_pool',None) |
28 |
|
return |
29 |
|
|
30 |
+ |
def envUniqueID(self): |
31 |
+ |
id = "https://"+common.scheduler.name().upper()+":/${LSB_BATCH_JID}-"+ \ |
32 |
+ |
string.replace(common._db.queryTask('name'),"_","-") |
33 |
+ |
return id |
34 |
+ |
|
35 |
|
def realSchedParams(self,cfg_params): |
36 |
|
""" |
37 |
< |
Return dictionary with specific parameters, to use |
38 |
< |
with real scheduler |
37 |
> |
Return dictionary with specific parameters, to use |
38 |
> |
with real scheduler |
39 |
|
""" |
40 |
< |
### use by the BossLite script |
40 |
> |
### use by the BossLite script |
41 |
|
self.cpCmd = cfg_params.get(self.name().upper()+'.cp_command','cp') |
42 |
|
self.rfioName = cfg_params.get(self.name().upper()+'.rfio_server','') |
43 |
|
|
44 |
|
params = { 'cpCmd' : self.cpCmd, \ |
45 |
< |
'rfipName' : self.rfioName |
45 |
> |
'rfioName' : self.rfioName |
46 |
|
} |
47 |
|
return params |
48 |
|
|
50 |
|
""" |
51 |
|
Returns parameter scheduler-specific, to use with BOSS . |
52 |
|
""" |
49 |
– |
index = int(common._db.nJobs()) - 1 |
53 |
|
sched_param= '' |
54 |
|
|
55 |
< |
for i in range(index): # Add loop DS |
56 |
< |
|
57 |
< |
sched_param= '' |
58 |
< |
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) + ' ' |
55 |
> |
if (self.queue): |
56 |
> |
sched_param += '-q '+self.queue +' ' |
57 |
> |
if (self.res): sched_param += ' -R '+self.res +' ' |
58 |
> |
# sched_param+='-cwd '+ str(self.outputDir) + ' ' |
59 |
|
return sched_param |
60 |
|
|
61 |
< |
def loggingInfo(self, id): |
61 |
> |
def listMatch(self, dest, full): |
62 |
> |
""" |
63 |
> |
""" |
64 |
> |
if len(dest)!=0: |
65 |
> |
sites = [self.blackWhiteListParser.cleanForBlackWhiteList(dest,'list')] |
66 |
> |
else: |
67 |
> |
sites = [str(getLocalDomain(self))] |
68 |
> |
return sites |
69 |
> |
|
70 |
> |
def loggingInfo(self, id, fname): |
71 |
|
""" return logging info about job nj """ |
72 |
< |
cmd = 'bjobs -l ' + id |
72 |
> |
lsfid = common._db.queryRunJob('schedulerId',id) |
73 |
> |
cmd = 'bjobs -l ' + str(lsfid[0]) |
74 |
|
cmd_out = runCommand(cmd) |
75 |
< |
return cmd_out |
75 |
> |
f = open(fname,'w') |
76 |
> |
f.write(cmd_out) |
77 |
> |
f.close() |
78 |
> |
return fname |
79 |
> |
|
80 |
> |
def wsCopyOutput(self): |
81 |
> |
txt=self.wsCopyOutput_comm(self.pool) |
82 |
> |
return txt |
83 |
|
|
84 |
|
def wsExitFunc(self): |
85 |
|
""" |
100 |
|
txt += '}\n' |
101 |
|
|
102 |
|
return txt |
88 |
– |
|