CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Static Public Attributes
runTheMatrix.TheMatrix Class Reference
Inheritance diagram for runTheMatrix.TheMatrix:

Public Member Functions

def __init__ (self, opt)
 
def complete_predefined (self, text, line, start_idx, end_idx)
 
def complete_searchInWorkflow (self, text, line, start_idx, end_idx)
 
def complete_showWorkflow (self, text, line, start_idx, end_idx)
 
def default (self, inp)
 
def do_clear (self, arg)
 
def do_dumpWorkflowId (self, arg)
 
def do_exit (self, arg)
 
def do_predefined (self, arg)
 
def do_search (self, arg)
 
def do_searchInWorkflow (self, arg)
 
def do_showWorkflow (self, arg)
 
def help_dumpWorkflowId (self)
 
def help_predefined (self)
 
def help_search (self)
 
def help_searchInWorkflow (self)
 
def help_showWorkflow (self)
 

Public Attributes

 matrices_
 
 opt_
 

Static Public Attributes

 do_EOF
 
 intro
 
 prompt
 

Detailed Description

Definition at line 445 of file runTheMatrix.py.

Constructor & Destructor Documentation

◆ __init__()

def runTheMatrix.TheMatrix.__init__ (   self,
  opt 
)

Definition at line 449 of file runTheMatrix.py.

449  def __init__(self, opt):
450  cmd.Cmd.__init__(self)
451  self.opt_ = opt
452  self.matrices_ = {}
453  tmp = MatrixReader(self.opt_)
454  for what in tmp.files:
455  what = what.replace('relval_','')
456  self.opt_.what = what
457  self.matrices_[what] = MatrixReader(self.opt_)
458  self.matrices_[what].prepare(self.opt_.useInput, self.opt_.refRel,
459  self.opt_.fromScratch)
460  os.system("clear")
461 
def __init__(self, dataset, job_number, job_id, job_name, isDA, isMC, applyBOWS, applyEXTRACOND, extraconditions, runboundary, lumilist, intlumi, maxevents, gt, allFromGT, alignmentDB, alignmentTAG, apeDB, apeTAG, bowDB, bowTAG, vertextype, tracktype, refittertype, ttrhtype, applyruncontrol, ptcut, CMSSW_dir, the_dir)

Member Function Documentation

◆ complete_predefined()

def runTheMatrix.TheMatrix.complete_predefined (   self,
  text,
  line,
  start_idx,
  end_idx 
)

Definition at line 479 of file runTheMatrix.py.

479  def complete_predefined(self, text, line, start_idx, end_idx):
480  if text and len(text) > 0:
481  return [t for t in predefinedSet.keys() if t.startswith(text)]
482  else:
483  return predefinedSet.keys()
484 

◆ complete_searchInWorkflow()

def runTheMatrix.TheMatrix.complete_searchInWorkflow (   self,
  text,
  line,
  start_idx,
  end_idx 
)

Definition at line 530 of file runTheMatrix.py.

References relativeConstraints.keys, and runTheMatrix.TheMatrix.matrices_.

530  def complete_searchInWorkflow(self, text, line, start_idx, end_idx):
531  if text and len(text) > 0:
532  return [t for t in self.matrices_.keys() if t.startswith(text)]
533  else:
534  return self.matrices_.keys()
535 

◆ complete_showWorkflow()

def runTheMatrix.TheMatrix.complete_showWorkflow (   self,
  text,
  line,
  start_idx,
  end_idx 
)

Definition at line 503 of file runTheMatrix.py.

References relativeConstraints.keys, and runTheMatrix.TheMatrix.matrices_.

503  def complete_showWorkflow(self, text, line, start_idx, end_idx):
504  if text and len(text) > 0:
505  return [t for t in self.matrices_.keys() if t.startswith(text)]
506  else:
507  return self.matrices_.keys()
508 

◆ default()

def runTheMatrix.TheMatrix.default (   self,
  inp 
)

Definition at line 470 of file runTheMatrix.py.

References runTheMatrix.TheMatrix.do_exit().

470  def default(self, inp):
471  if inp == 'x' or inp == 'q':
472  return self.do_exit(inp)
473 

◆ do_clear()

def runTheMatrix.TheMatrix.do_clear (   self,
  arg 
)
Clear the screen, put prompt at the top

Definition at line 462 of file runTheMatrix.py.

462  def do_clear(self, arg):
463  """Clear the screen, put prompt at the top"""
464  os.system("clear")
465 

◆ do_dumpWorkflowId()

def runTheMatrix.TheMatrix.do_dumpWorkflowId (   self,
  arg 
)

Definition at line 576 of file runTheMatrix.py.

References dqmMemoryStats.float, mps_monitormerge.items, runTheMatrix.TheMatrix.matrices_, print(), and str.

576  def do_dumpWorkflowId(self, arg):
577  wflids = arg.split()
578  if len(wflids) == 0:
579  print("dumpWorkflowId [wfl-id1 [...]]")
580  return
581 
582  fmt = "[%d]: %s\n"
583  maxLen = 100
584  for wflid in wflids:
585  dump = True
586  for key, mrd in self.matrices_.items():
587  for wfl in mrd.workFlows:
588  if wfl.numId == float(wflid):
589  wfName, stepNames = wfl.nameId.split('+',1)
590  if dump:
591  dump = False
592  print(wfl.numId, stepNames)
593  for i,s in enumerate(wfl.cmds):
594  print(fmt % (i+1, (str(s)+' ')))
595  print("\nWorkflow found in %s." % key)
596  else:
597  print("Workflow also found in %s." % key)
598 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
#define str(s)

◆ do_exit()

def runTheMatrix.TheMatrix.do_exit (   self,
  arg 
)

Definition at line 466 of file runTheMatrix.py.

References print().

Referenced by runTheMatrix.TheMatrix.default().

466  def do_exit(self, arg):
467  print("Leaving the Matrix")
468  return True
469 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47

◆ do_predefined()

def runTheMatrix.TheMatrix.do_predefined (   self,
  arg 
)
Print the list of predefined workflows

Definition at line 485 of file runTheMatrix.py.

References print().

485  def do_predefined(self, arg):
486  """Print the list of predefined workflows"""
487  print("List of predefined workflows")
488  if arg:
489  for w in arg.split():
490  if w in predefinedSet.keys():
491  print("Predefined Set: %s" % w)
492  print(predefinedSet[w])
493  else:
494  print("Unknown Set: %s" % w)
495  else:
496  print(predefinedSet.keys())
497 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47

◆ do_search()

def runTheMatrix.TheMatrix.do_search (   self,
  arg 
)

Definition at line 564 of file runTheMatrix.py.

References runTheMatrix.TheMatrix.do_searchInWorkflow(), join(), relativeConstraints.keys, runTheMatrix.TheMatrix.matrices_, and print().

564  def do_search(self, arg):
565  args = arg.split()
566  if len(args) < 1:
567  print("search regexp")
568  return
569  for wfl in self.matrices_.keys():
570  self.do_searchInWorkflow(' '.join([wfl, args[0]]))
571 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
static std::string join(char **cmd)
Definition: RemoteFile.cc:19

◆ do_searchInWorkflow()

def runTheMatrix.TheMatrix.do_searchInWorkflow (   self,
  arg 
)

Definition at line 536 of file runTheMatrix.py.

References relativeConstraints.keys, runTheMatrix.TheMatrix.matrices_, and print().

Referenced by runTheMatrix.TheMatrix.do_search().

536  def do_searchInWorkflow(self, arg):
537  args = arg.split()
538  if len(args) < 2:
539  print("searchInWorkflow name regexp")
540  return
541  if args[0] not in self.matrices_.keys():
542  print("Unknown workflow")
543  return
544  import re
545  pattern = None
546  try:
547  pattern = re.compile(args[1])
548  except:
549  print("Failed to compile regexp %s" % args[1])
550  return
551  counter = 0
552  for wfl in self.matrices_[args[0]].workFlows:
553  wfName, stepNames = wfl.nameId.split('+',1)
554  if re.match(pattern, wfName) or re.match(pattern, stepNames):
555  print("%s %s %s" % (wfl.numId, wfName, stepNames))
556  counter += 1
557  print("Found %d compatible workflows inside %s" % (counter, args[0]))
558 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47

◆ do_showWorkflow()

def runTheMatrix.TheMatrix.do_showWorkflow (   self,
  arg 
)

Definition at line 509 of file runTheMatrix.py.

References relativeConstraints.keys, runTheMatrix.TheMatrix.matrices_, and print().

509  def do_showWorkflow(self, arg):
510  if arg == '':
511  print("Available workflows:")
512  for k in self.matrices_.keys():
513  print(k)
514  else:
515  selected = arg.split()
516  for k in selected:
517  if k not in self.matrices_.keys():
518  print("Unknown workflow %s: skipping" % k)
519  else:
520  for wfl in self.matrices_[k].workFlows:
521  wfName, stepNames = wfl.nameId.split('+',1)
522  print("%s %s %s" % (wfl.numId, wfName, stepNames))
523  print("%s contains %d workflows" % (k, len(self.matrices_[k].workFlows)))
524 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47

◆ help_dumpWorkflowId()

def runTheMatrix.TheMatrix.help_dumpWorkflowId (   self)

Definition at line 572 of file runTheMatrix.py.

References join(), and print().

572  def help_dumpWorkflowId(self):
573  print("\n".join(["dumpWorkflowId [wfl-id1 [...]]\n",
574  "Dumps the details (cmsDriver commands for all steps) of the space-separated workflow-ids in input."]))
575 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
static std::string join(char **cmd)
Definition: RemoteFile.cc:19

◆ help_predefined()

def runTheMatrix.TheMatrix.help_predefined (   self)

Definition at line 474 of file runTheMatrix.py.

References join(), and print().

474  def help_predefined(self):
475  print("\n".join(["predefined [predef1 [...]]\n",
476  "Run w/o argument, it will print the list of known predefined workflows.",
477  "Run with space-separated predefined workflows, it will print the workflow-ids registered to them"]))
478 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
static std::string join(char **cmd)
Definition: RemoteFile.cc:19

◆ help_search()

def runTheMatrix.TheMatrix.help_search (   self)

Definition at line 559 of file runTheMatrix.py.

References join(), and print().

559  def help_search(self):
560  print("\n".join(["search search_regexp\n",
561  "This command will search for a match within all workflows registered.",
562  "The search is done on both the workflow name and the names of steps registered to it."]))
563 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
static std::string join(char **cmd)
Definition: RemoteFile.cc:19

◆ help_searchInWorkflow()

def runTheMatrix.TheMatrix.help_searchInWorkflow (   self)

Definition at line 525 of file runTheMatrix.py.

References join(), and print().

525  def help_searchInWorkflow(self):
526  print("\n".join(["searchInWorkflow wfl_name search_regexp\n",
527  "This command will search for a match within all workflows registered to wfl_name.",
528  "The search is done on both the workflow name and the names of steps registered to it."]))
529 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
static std::string join(char **cmd)
Definition: RemoteFile.cc:19

◆ help_showWorkflow()

def runTheMatrix.TheMatrix.help_showWorkflow (   self)

Definition at line 498 of file runTheMatrix.py.

References join(), and print().

498  def help_showWorkflow(self):
499  print("\n".join(["showWorkflow [workflow1 [...]]\n",
500  "Run w/o arguments, it will print the list of registered macro-workflows.",
501  "Run with space-separated workflows, it will print the full list of workflow-ids registered to them"]))
502 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
static std::string join(char **cmd)
Definition: RemoteFile.cc:19

Member Data Documentation

◆ do_EOF

runTheMatrix.TheMatrix.do_EOF
static

Definition at line 599 of file runTheMatrix.py.

◆ intro

runTheMatrix.TheMatrix.intro
static

Definition at line 446 of file runTheMatrix.py.

◆ matrices_

runTheMatrix.TheMatrix.matrices_

◆ opt_

runTheMatrix.TheMatrix.opt_

Definition at line 451 of file runTheMatrix.py.

◆ prompt

runTheMatrix.TheMatrix.prompt
static

Definition at line 447 of file runTheMatrix.py.