Functions | Variables
submit_mcc Namespace Reference

Functions

def call_project_py (xml, stg, act, test=False)
 
def handle_stage (workflow_def, xml, workflow, stage, nocheck=False, test=False)
 

Variables

string ECL_URL = "http://dbweb6.fnal.gov:8080/ECL/dunepro"
 
 now = datetime.now().strftime('%Y%m%d%H%M%S')
 
 log_stream = StringIO()
 
string FORMAT = '%(asctime)s - submit_mcc.py - %(levelname)s - %(message)s'
 
 stream
 
 level
 
 INFO
 
 format
 
 parser = argparse.ArgumentParser(description='')
 
 groupArg = parser.add_argument_group('require arguments')
 
 metavar
 
 type
 
 help
 
 required
 
 action
 
 str
 
 default
 
 args = parser.parse_args()
 
 cwd = os.getcwd()
 
 ecl_entry
 
 name
 
 value
 
tuple logfile = ('log_mcc_submit_{}.txt'.format(now))
 
 filename
 
 elconn
 
 response = elconn.post(ecl_entry)
 

Function Documentation

def submit_mcc.call_project_py (   xml,
  stg,
  act,
  test = False 
)

Definition at line 26 of file submit_mcc.py.

26 def call_project_py(xml, stg, act, test=False):
27  if test:
28  tmpdir = "/pnfs/dune/scratch/dunepro/mcc10_test/test_{}".format(now)
29  subprocess.call("mkdir -p {}".format(tmpdir), shell=True)
30  overrides = ["wrap_proj", "-Onumevents=10",
31  "-Ostage.numjobs=1", "-Ostage.outdir={tmp}",
32  "-Ostage.workdir={tmp}".format(tmp=tmpdir)]
33  logging.info("Submitting a test job with:")
34  logging.info(" numberjobs = 1;")
35  logging.info(" numevents = 1;")
36  logging.info(" outdir = {};".format(tmpdir))
37  logging.info(" workdir = {};".format(tmpdir))
38  else:
39  overrides = []
40  prj_cmd = overrides + ["project.py", "--xml", xml, "--stage", stg,
41  "--{}".format(act)]
42  try:
43  prj_out = subprocess.check_output(prj_cmd, stderr=subprocess.STDOUT)
44  logging.info("project.py was run successfully.")
45  logging.info("project.py output: {}".format(prj_out))
46  except subprocess.CalledProcessError as e:
47  logging.error("project.py exit with {}.".format(e.returncode))
48  logging.error("project.py output: {}.".format(e.output))
49  logging.error("Exiting now!")
50  print(log_stream.getvalue())
51  sys.exit(40)
52  return
53 
def call_project_py(xml, stg, act, test=False)
Definition: submit_mcc.py:26
def submit_mcc.handle_stage (   workflow_def,
  xml,
  workflow,
  stage,
  nocheck = False,
  test = False 
)

Definition at line 54 of file submit_mcc.py.

54 def handle_stage(workflow_def, xml, workflow, stage, nocheck=False, test=False):
55  wf_dict = json.load(open(workflow_def))
56  workflows = wf_dict["workflows"]
57  if workflow not in workflows:
58  logging.error("Workflow chosen is not defined in the json file.")
59  print(log_stream.getvalue())
60  sys.exit(30)
61  if stage not in workflows[workflow]["stages"]:
62  logging.error("Stage is not defined in the workflow.")
63  print(log_stream.getvalue())
64  sys.exit(31)
65  stages = workflows[workflow]["stages"]
66  actions = workflows[workflow]["actions"]
67  stage_index = stages.index(stage)
68  action = actions[stage_index]
69  # not checking on previous stage if:
70  # 1) '--no-check' is enabled;
71  # 2) '--test' is enabled, cannot check on test jobs since xml file is
72  # generated on the fly with parameter overrides;
73  # 3) if the stage is the first stage of a workflow.
74  if stage_index == 0 or test:
75  nocheck=True
76  if not nocheck:
77  prev_stage = stages[stage_index-1]
78  logging.info("Checking previous stage: {}".format(prev_stage))
79  call_project_py(xml, prev_stage, "check")
80  time.sleep(10)
81  logging.info("Handle stage: {} with action: {}".format(stage, action))
82  call_project_py(xml, stage, action, test)
83  return
84 
int open(const char *, int)
Opens a file descriptor.
def call_project_py(xml, stg, act, test=False)
Definition: submit_mcc.py:26
def handle_stage(workflow_def, xml, workflow, stage, nocheck=False, test=False)
Definition: submit_mcc.py:54

Variable Documentation

submit_mcc.action

Definition at line 96 of file submit_mcc.py.

submit_mcc.args = parser.parse_args()

Definition at line 116 of file submit_mcc.py.

submit_mcc.cwd = os.getcwd()

Definition at line 117 of file submit_mcc.py.

submit_mcc.default

Definition at line 100 of file submit_mcc.py.

submit_mcc.ecl_entry
Initial value:
2  category=args.ecl_category,
3  tags=['MCCSubmission'],
4  formname='MCC Submission',
5  preformatted=False)

Definition at line 150 of file submit_mcc.py.

string submit_mcc.ECL_URL = "http://dbweb6.fnal.gov:8080/ECL/dunepro"

Definition at line 13 of file submit_mcc.py.

submit_mcc.elconn
Initial value:
1 = ECLConnection(url=ECL_URL, username=args.ecl_user,
2  password=args.ecl_password)

Definition at line 173 of file submit_mcc.py.

submit_mcc.filename

Definition at line 170 of file submit_mcc.py.

string submit_mcc.FORMAT = '%(asctime)s - submit_mcc.py - %(levelname)s - %(message)s'

Definition at line 23 of file submit_mcc.py.

submit_mcc.format

Definition at line 24 of file submit_mcc.py.

submit_mcc.groupArg = parser.add_argument_group('require arguments')

Definition at line 87 of file submit_mcc.py.

submit_mcc.help

Definition at line 90 of file submit_mcc.py.

submit_mcc.INFO

Definition at line 24 of file submit_mcc.py.

submit_mcc.level

Definition at line 24 of file submit_mcc.py.

submit_mcc.log_stream = StringIO()

Definition at line 22 of file submit_mcc.py.

submit_mcc.logfile = ('log_mcc_submit_{}.txt'.format(now))

Definition at line 166 of file submit_mcc.py.

submit_mcc.metavar

Definition at line 89 of file submit_mcc.py.

submit_mcc.name

Definition at line 159 of file submit_mcc.py.

submit_mcc.now = datetime.now().strftime('%Y%m%d%H%M%S')

Definition at line 14 of file submit_mcc.py.

submit_mcc.parser = argparse.ArgumentParser(description='')

Definition at line 86 of file submit_mcc.py.

submit_mcc.required

Definition at line 90 of file submit_mcc.py.

submit_mcc.response = elconn.post(ecl_entry)

Definition at line 177 of file submit_mcc.py.

submit_mcc.str

Definition at line 100 of file submit_mcc.py.

submit_mcc.stream

Definition at line 24 of file submit_mcc.py.

submit_mcc.type

Definition at line 89 of file submit_mcc.py.

submit_mcc.value

Definition at line 159 of file submit_mcc.py.