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) |
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.return_data = cfg_params.get('USER.return_data', 0) |
41 |
> |
self.copy_data = cfg_params.get("USER.copy_data", 0) |
42 |
> |
|
43 |
> |
if ( int(self.return_data) == 0 and int(self.copy_data) == 0 ): |
44 |
> |
msg = 'Error: return_data and copy_data cannot be set both to 0\n' |
45 |
> |
msg = msg + 'Please modify your crab.cfg file\n' |
46 |
> |
raise CrabException(msg) |
47 |
> |
|
48 |
> |
if ( int(self.return_data) == 1 and int(self.copy_data) == 1 ): |
49 |
> |
msg = 'Error: return_data and copy_data cannot be set both to 1\n' |
50 |
> |
msg = msg + 'Please modify your crab.cfg file\n' |
51 |
> |
raise CrabException(msg) |
52 |
> |
|
53 |
> |
if ( int(self.copy_data) == 0 and int(self.publish_data) == 1 ): |
54 |
> |
msg = 'Warning: publish_data = 1 must be used with copy_data = 1\n' |
55 |
> |
msg = msg + 'Please modify copy_data value in your crab.cfg file\n' |
56 |
> |
common.logger.info(msg) |
57 |
> |
raise CrabException(msg) |
58 |
> |
|
59 |
> |
if int(self.copy_data) == 1: |
60 |
> |
self.SE = cfg_params.get('USER.storage_element', None) |
61 |
> |
if not self.SE: |
62 |
> |
msg = "Error. The [USER] section has no 'storage_element'" |
63 |
> |
common.logger.info(msg) |
64 |
> |
raise CrabException(msg) |
65 |
> |
|
66 |
> |
self.proxyValid = 0 |
67 |
> |
self.dontCheckProxy = int(cfg_params.get("GRID.dont_check_proxy",0)) |
68 |
> |
self.proxyServer = cfg_params.get("GRID.proxy_server",'myproxy.cern.ch') |
69 |
> |
common.logger.debug('Setting myproxy server to ' + self.proxyServer) |
70 |
> |
|
71 |
> |
self.group = cfg_params.get("GRID.group", None) |
72 |
> |
self.role = cfg_params.get("GRID.role", None) |
73 |
> |
self.VO = cfg_params.get('GRID.virtual_organization', 'cms') |
74 |
> |
|
75 |
> |
self.checkProxy() |
76 |
> |
|
77 |
|
self.role = None |
78 |
< |
|
78 |
> |
|
79 |
|
self.pool = cfg_params.get('USER.storage_pool',None) |
80 |
< |
## default is 48 hours CPU time, 2G memrory |
81 |
< |
self.cpu = cfg_params.get('USER.cpu',172800) |
36 |
< |
self.vmem = cfg_params.get('USER.vmem',2) |
80 |
> |
# self.cpu = cfg_params.get('USER.cpu',172800) |
81 |
> |
# self.vmem = cfg_params.get('USER.vmem',2) |
82 |
|
return |
83 |
|
|
84 |
+ |
def envUniqueID(self): |
85 |
+ |
id = "https://"+common.scheduler.name()+":/${JOB_ID}-"+ \ |
86 |
+ |
string.replace(common._db.queryTask('name'),"_","-") |
87 |
+ |
return id |
88 |
+ |
|
89 |
|
def realSchedParams(self,cfg_params): |
90 |
|
""" |
91 |
< |
Return dictionary with specific parameters, to use |
92 |
< |
with real scheduler |
91 |
> |
Return dictionary with specific parameters, to use |
92 |
> |
with real scheduler |
93 |
|
""" |
94 |
|
params = {} |
95 |
|
return params |
105 |
|
sched_param= '' |
106 |
|
if (self.queue): |
107 |
|
sched_param += '-q '+self.queue +' ' |
108 |
< |
if (self.res): sched_param += ' -R '+self.res +' ' |
109 |
< |
pass |
108 |
> |
if (self.res): sched_param += self.res +' ' |
109 |
> |
|
110 |
> |
|
111 |
> |
pass |
112 |
|
|
113 |
|
#default is request 2G memory and 48 hours CPU time |
114 |
|
#sched_param += ' -V -l h_vmem=2G -l h_cpu=172800 ' |
115 |
< |
sched_param += ' -V -l h_vmem=' |
116 |
< |
sched_param += self.vmem.__str__() |
117 |
< |
sched_param += 'G -l h_cpu=' |
118 |
< |
sched_param += self.cpu.__str__() |
119 |
< |
sched_param += ' ' |
115 |
> |
# sched_param += ' -V -l h_vmem=' |
116 |
> |
# sched_param += self.vmem.__str__() |
117 |
> |
# sched_param += 'G -l h_cpu=' |
118 |
> |
# sched_param += self.cpu.__str__() |
119 |
> |
# sched_param += ' ' |
120 |
|
|
121 |
|
return sched_param |
122 |
|
|
138 |
|
txt += self.wsExitFunc_common() |
139 |
|
|
140 |
|
txt += ' cp ${SGE_STDOUT_PATH} CMSSW_${NJob}.stdout \n' |
141 |
< |
txt += ' cp ${SGE_STDERR_PATH} CMSSW_${NJob}.stderr \n' |
141 |
> |
txt += ' cp ${SGE_STDERR_PATH} CMSSW_${NJob}.stderr \n' |
142 |
|
txt += ' tar zcvf ${out_files}.tgz ${filesToCheck}\n' |
143 |
|
txt += ' exit $job_exit_code\n' |
144 |
|
txt += '}\n' |
147 |
|
|
148 |
|
def listMatch(self, dest, full): |
149 |
|
""" |
150 |
< |
""" |
151 |
< |
#if len(dest)!=0: |
150 |
> |
""" |
151 |
> |
#if len(dest)!=0: |
152 |
|
sites = [self.blackWhiteListParser.cleanForBlackWhiteList(dest,'list')] |
153 |
< |
#else: |
154 |
< |
# sites = [str(getLocalDomain(self))] |
155 |
< |
return sites |
153 |
> |
#else: |
154 |
> |
# sites = [str(getLocalDomain(self))] |
155 |
> |
return sites |
156 |
|
|
157 |
|
def wsCopyOutput(self): |
158 |
|
txt=self.wsCopyOutput_comm(self.pool) |
168 |
|
tmp=tmp.rstrip(',') |
169 |
|
tmp=tmp.rstrip(',') |
170 |
|
|
171 |
< |
|
171 |
> |
|
172 |
|
return "/CN="+tmp.strip() |