Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
CalibMuon
DTCalibration
python
Workflow
CrabTask.py
Go to the documentation of this file.
1
from
crabWrap
import
crabCreate,crabSubmit,crabWatch,getOutput
2
from
tools
import
replaceTemplate
3
import
os
4
#from threading import Thread
5
6
#class CrabTask(Thread):
7
class
CrabTask
:
8
def
__init__
(self, dir, crab_cfg, pset=None, pset_name='mypset.py'):
9
#Thread.__init__(self)
10
self.
dir
= dir
11
12
self.
crabCfg_name
=
'crab.cfg'
13
self.
crab_cfg
= crab_cfg
14
15
self.
pset_name
= pset_name
16
self.
pset
= pset
17
self.
initializeTask
(dir=self.
dir
)
18
19
def
initializeTask
(self, dir):
20
if
not
os.path.exists(dir): os.makedirs(dir)
21
22
# Write pset
23
if
self.
pset
:
24
self.crab_cfg.set(
'CMSSW'
,
'pset'
,self.
pset_name
)
25
open(dir +
'/'
+ self.
pset_name
,
'w'
).
write
(self.
pset
)
26
27
# Write CRAB cfg
28
self.crab_cfg.write(open(dir +
'/'
+ self.
crabCfg_name
,
'w'
))
29
30
def
create
(self,dir):
31
self.
project
=
crabCreate
(dir,self.
crabCfg_name
)
32
return
self.
project
33
34
def
submit
(self):
35
if
not
self.
project
:
raise
RuntimeError
36
crabSubmit
(self.
project
)
37
38
def
getoutput
(self):
39
if
not
self.
project
:
raise
RuntimeError
40
getOutput
(self.
project
)
41
42
#def watch(self):
43
# if not self.project: raise RuntimeError
44
# crabWatch(getOutput,self.project)
45
46
def
run
(self):
47
#self.initializeTask(dir=self.dir)
48
proj = self.
create
(self.
dir
)
49
self.
submit
()
50
return
proj
CrabTask.CrabTask.project
project
Definition:
CrabTask.py:31
TablePrint.write
write
Definition:
TablePrint.py:3
CrabTask.CrabTask.pset_name
pset_name
Definition:
CrabTask.py:15
CrabTask.CrabTask
Definition:
CrabTask.py:7
CrabTask.CrabTask.run
def run
Definition:
CrabTask.py:46
CrabTask.CrabTask.submit
def submit
Definition:
CrabTask.py:34
CrabTask.CrabTask.__init__
def __init__
Definition:
CrabTask.py:8
crabWrap.crabCreate
def crabCreate
Definition:
crabWrap.py:137
CrabTask.CrabTask.crab_cfg
crab_cfg
Definition:
CrabTask.py:13
CrabTask.CrabTask.pset
pset
Definition:
CrabTask.py:16
CrabTask.CrabTask.dir
dir
Definition:
CrabTask.py:10
crabWrap.crabSubmit
def crabSubmit
Definition:
crabWrap.py:150
CrabTask.CrabTask.crabCfg_name
crabCfg_name
Definition:
CrabTask.py:12
CrabTask.CrabTask.create
def create
Definition:
CrabTask.py:30
CrabTask.CrabTask.getoutput
def getoutput
Definition:
CrabTask.py:38
CrabTask.CrabTask.initializeTask
def initializeTask
Definition:
CrabTask.py:19
crabWrap.getOutput
def getOutput
Definition:
crabWrap.py:230
Generated for CMSSW Reference Manual by
1.8.5