1 from __future__
import print_function
2 from __future__
import absolute_import
5 from .tools
import loadCmsProcess
6 from .DTWorkflow
import DTWorkflow
7 from .DTTtrigWorkflow
import DTttrigWorkflow
8 from .DTVdriftWorkflow
import DTvdriftWorkflow
11 log = logging.getLogger(__name__)
15 """ This class serves as a top level helper to perform all available
16 workflows. Additional workflow classes should use the naming scheme
17 DT${WORKFLOWNAME}Workflow and implement a classmethod function add_parser_options.
19 available_workflows = [
"ttrig",
"vdrift",
"T0Wire"]
27 class_name =
"DT" + self.
options.workflow +
"Workflow"
28 workflow_class = eval(class_name)
29 workflow_class_instance = workflow_class(self.
options)
30 workflow_class_instance.run()
31 return workflow_class_instance.local_path
35 if not "/crabclient/3" in os.environ[
"PATH"]:
42 command = [
'bash',
'-c',
'unset module;source /cvmfs/cms.cern.ch/crab3/crab.sh && env']
43 proc = subprocess.Popen(command, stdout = subprocess.PIPE)
45 print(
'setting up crab')
46 for line
in proc.stdout:
47 (key, _, value) = line.partition(
"=")
48 os.environ[key] = value.replace(
"\n",
"")
49 for path
in os.environ[
'PYTHONPATH'].
split(
':'):
55 workflow_parser = DTWorkflow.add_parser_options(parser)
56 for workflow
in cls.available_workflows:
57 class_name =
"DT" + workflow +
"Workflow"
59 workflow_class = eval( class_name )
60 workflow_class.add_parser_options(workflow_parser)
62 log.error(
"No class with name: %s exists bot workflow exists in %s" %
63 (class_name, DTCalibrationWorker)