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 |
|
|
7 |
|
import os,string |
18 |
|
|
19 |
|
def __init__(self): |
20 |
|
Scheduler.__init__(self,"SGE") |
21 |
< |
|
21 |
> |
self.datasetPath = None |
22 |
> |
self.selectNoInput = None |
23 |
|
return |
24 |
|
|
25 |
|
def configure(self, cfg_params): |
26 |
|
SchedulerLocal.configure(self, cfg_params) |
27 |
– |
self.environment_unique_identifier = "https://"+common.scheduler.name()+":/${JOB_ID}-"+ \ |
28 |
– |
string.replace(common._db.queryTask('name'),"_","-") |
27 |
|
|
28 |
< |
#self.role = cfg_params.get("EDG.role", None) |
29 |
< |
self.role = None |
30 |
< |
|
28 |
> |
try: |
29 |
> |
tmp = cfg_params['CMSSW.datasetpath'] |
30 |
> |
if tmp.lower() == 'none': |
31 |
> |
self.datasetPath = None |
32 |
> |
self.selectNoInput = 1 |
33 |
> |
else: |
34 |
> |
self.datasetPath = tmp |
35 |
> |
self.selectNoInput = 0 |
36 |
> |
except KeyError: |
37 |
> |
msg = "Error: datasetpath not defined " |
38 |
> |
raise CrabException(msg) |
39 |
> |
|
40 |
|
self.pool = cfg_params.get('USER.storage_pool',None) |
34 |
– |
## default is 48 hours CPU time, 2G memrory |
35 |
– |
self.cpu = cfg_params.get('USER.cpu',172800) |
36 |
– |
self.vmem = cfg_params.get('USER.vmem',2) |
41 |
|
return |
42 |
|
|
43 |
+ |
def envUniqueID(self): |
44 |
+ |
id = "https://"+common.scheduler.name()+":/${JOB_ID}-"+ \ |
45 |
+ |
string.replace(common._db.queryTask('name'),"_","-") |
46 |
+ |
return id |
47 |
+ |
|
48 |
|
def realSchedParams(self,cfg_params): |
49 |
|
""" |
50 |
< |
Return dictionary with specific parameters, to use |
51 |
< |
with real scheduler |
50 |
> |
Return dictionary with specific parameters, to use |
51 |
> |
with real scheduler |
52 |
|
""" |
53 |
|
params = {} |
54 |
|
return params |
64 |
|
sched_param= '' |
65 |
|
if (self.queue): |
66 |
|
sched_param += '-q '+self.queue +' ' |
67 |
< |
if (self.res): sched_param += ' -R '+self.res +' ' |
68 |
< |
pass |
67 |
> |
if (self.res): sched_param += '-l '+self.res +' ' |
68 |
> |
|
69 |
> |
pass |
70 |
|
|
71 |
|
#default is request 2G memory and 48 hours CPU time |
72 |
|
#sched_param += ' -V -l h_vmem=2G -l h_cpu=172800 ' |
73 |
< |
sched_param += ' -V -l h_vmem=' |
74 |
< |
sched_param += self.vmem.__str__() |
75 |
< |
sched_param += 'G -l h_cpu=' |
76 |
< |
sched_param += self.cpu.__str__() |
77 |
< |
sched_param += ' ' |
73 |
> |
# sched_param += ' -V -l h_vmem=' |
74 |
> |
# sched_param += self.vmem.__str__() |
75 |
> |
# sched_param += 'G -l h_cpu=' |
76 |
> |
# sched_param += self.cpu.__str__() |
77 |
> |
# sched_param += ' ' |
78 |
|
|
79 |
|
return sched_param |
80 |
|
|
96 |
|
txt += self.wsExitFunc_common() |
97 |
|
|
98 |
|
txt += ' cp ${SGE_STDOUT_PATH} CMSSW_${NJob}.stdout \n' |
99 |
< |
txt += ' cp ${SGE_STDERR_PATH} CMSSW_${NJob}.stderr \n' |
99 |
> |
txt += ' cp ${SGE_STDERR_PATH} CMSSW_${NJob}.stderr \n' |
100 |
|
txt += ' tar zcvf ${out_files}.tgz ${filesToCheck}\n' |
101 |
|
txt += ' exit $job_exit_code\n' |
102 |
|
txt += '}\n' |
105 |
|
|
106 |
|
def listMatch(self, dest, full): |
107 |
|
""" |
108 |
< |
""" |
99 |
< |
#if len(dest)!=0: |
108 |
> |
""" |
109 |
|
sites = [self.blackWhiteListParser.cleanForBlackWhiteList(dest,'list')] |
110 |
< |
#else: |
102 |
< |
# sites = [str(getLocalDomain(self))] |
103 |
< |
return sites |
110 |
> |
return sites |
111 |
|
|
112 |
|
def wsCopyOutput(self): |
113 |
|
txt=self.wsCopyOutput_comm(self.pool) |
123 |
|
tmp=tmp.rstrip(',') |
124 |
|
tmp=tmp.rstrip(',') |
125 |
|
|
126 |
< |
|
126 |
> |
|
127 |
|
return "/CN="+tmp.strip() |