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 463 of file runTheMatrix.py.

Constructor & Destructor Documentation

◆ __init__()

def runTheMatrix.TheMatrix.__init__ (   self,
  opt 
)

Definition at line 467 of file runTheMatrix.py.

467  def __init__(self, opt):
468  cmd.Cmd.__init__(self)
469  self.opt_ = opt
470  self.matrices_ = {}
471  tmp = MatrixReader(self.opt_)
472  for what in tmp.files:
473  what = what.replace('relval_','')
474  self.opt_.what = what
475  self.matrices_[what] = MatrixReader(self.opt_)
476  self.matrices_[what].prepare(self.opt_.useInput, self.opt_.refRel,
477  self.opt_.fromScratch)
478  os.system("clear")
479 
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 503 of file runTheMatrix.py.

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

◆ complete_searchInWorkflow()

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

Definition at line 555 of file runTheMatrix.py.

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

555  def complete_searchInWorkflow(self, text, line, start_idx, end_idx):
556  if text and len(text) > 0:
557  return [t for t in self.matrices_.keys() if t.startswith(text)]
558  else:
559  return self.matrices_.keys()
560 

◆ complete_showWorkflow()

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

Definition at line 527 of file runTheMatrix.py.

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

527  def complete_showWorkflow(self, text, line, start_idx, end_idx):
528  if text and len(text) > 0:
529  return [t for t in self.matrices_.keys() if t.startswith(text)]
530  else:
531  return self.matrices_.keys()
532 

◆ default()

def runTheMatrix.TheMatrix.default (   self,
  inp 
)

Definition at line 488 of file runTheMatrix.py.

References runTheMatrix.TheMatrix.do_exit(), and print().

488  def default(self, inp):
489  if inp == 'x' or inp == 'q':
490  return self.do_exit(inp)
491  else:
492  is_pipe = not isatty(sys.stdin.fileno())
493  print(Fore.RED + "Error: " + Fore.RESET + "unrecognized command.")
494  # Quit only if given a piped command.
495  if is_pipe:
496  sys.exit(1)
497 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47

◆ do_clear()

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

Definition at line 480 of file runTheMatrix.py.

480  def do_clear(self, arg):
481  """Clear the screen, put prompt at the top"""
482  os.system("clear")
483 

◆ do_dumpWorkflowId()

def runTheMatrix.TheMatrix.do_dumpWorkflowId (   self,
  arg 
)

Definition at line 602 of file runTheMatrix.py.

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

602  def do_dumpWorkflowId(self, arg):
603  wflids = arg.split()
604  if len(wflids) == 0:
605  print("dumpWorkflowId [wfl-id1 [...]]")
606  return
607 
608  fmt = "[%s]: %s\n"
609  maxLen = 100
610  for wflid in wflids:
611  dump = True
612  for key, mrd in self.matrices_.items():
613  for wfl in mrd.workFlows:
614  if wfl.numId == float(wflid):
615  if dump:
616  dump = False
617  print(Fore.GREEN + str(wfl.numId) + Fore.RESET + " " + Fore.YELLOW + wfl.nameId + Fore.RESET)
618  for i,s in enumerate(wfl.cmds):
619  print(fmt % (Fore.RED + str(i+1) + Fore.RESET,
620  (str(s)+' ')))
621  print("\nWorkflow found in %s." % key)
622  else:
623  print("Workflow also found in %s." % key)
624 
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 484 of file runTheMatrix.py.

References print().

Referenced by runTheMatrix.TheMatrix.default().

484  def do_exit(self, arg):
485  print("Leaving the Matrix")
486  return True
487 
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 509 of file runTheMatrix.py.

References join(), print(), and str.

509  def do_predefined(self, arg):
510  """Print the list of predefined workflows"""
511  print("List of predefined workflows")
512  if arg:
513  for w in arg.split():
514  if w in predefinedSet.keys():
515  print("Predefined Set: %s" % w)
516  print(predefinedSet[w])
517  else:
518  print("Unknown Set: %s" % w)
519  else:
520  print("[ " + Fore.RED + ", ".join([str(k) for k in predefinedSet.keys()]) + Fore.RESET + " ]")
521 
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
#define str(s)

◆ do_search()

def runTheMatrix.TheMatrix.do_search (   self,
  arg 
)

Definition at line 590 of file runTheMatrix.py.

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

590  def do_search(self, arg):
591  args = arg.split()
592  if len(args) < 1:
593  print("search regexp")
594  return
595  for wfl in self.matrices_.keys():
596  self.do_searchInWorkflow(' '.join([wfl, args[0]]))
597 
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 561 of file runTheMatrix.py.

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

Referenced by runTheMatrix.TheMatrix.do_search().

561  def do_searchInWorkflow(self, arg):
562  args = arg.split()
563  if len(args) < 2:
564  print("searchInWorkflow name regexp")
565  return
566  if args[0] not in self.matrices_.keys():
567  print("Unknown workflow")
568  return
569  import re
570  pattern = None
571  try:
572  pattern = re.compile(args[1])
573  except:
574  print("Failed to compile regexp %s" % args[1])
575  return
576  counter = 0
577  for wfl in self.matrices_[args[0]].workFlows:
578  if re.match(pattern, wfl.nameId):
579  print("%s %s" % (Fore.BLUE + str(wfl.numId) + Fore.RESET,
580  Fore.GREEN + wfl.nameId + Fore.RESET))
581  counter +=1
582  print("Found %s compatible workflows inside %s" % (Fore.RED + str(counter) + Fore.RESET,
583  Fore.YELLOW + str(args[0])) + Fore.RESET)
584 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
#define str(s)

◆ do_showWorkflow()

def runTheMatrix.TheMatrix.do_showWorkflow (   self,
  arg 
)

Definition at line 533 of file runTheMatrix.py.

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

533  def do_showWorkflow(self, arg):
534  if arg == '':
535  print("Available workflows:")
536  for k in self.matrices_.keys():
537  print(Fore.RED + Style.BRIGHT + k)
538  print(Style.RESET_ALL)
539  else:
540  selected = arg.split()
541  for k in selected:
542  if k not in self.matrices_.keys():
543  print("Unknown workflow %s: skipping" % k)
544  else:
545  for wfl in self.matrices_[k].workFlows:
546  print("%s %s" % (Fore.BLUE + str(wfl.numId) + Fore.RESET,
547  Fore.GREEN + wfl.nameId + Fore.RESET))
548  print("%s contains %d workflows" % (Fore.RED + k + Fore.RESET, len(self.matrices_[k].workFlows)))
549 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
#define str(s)

◆ help_dumpWorkflowId()

def runTheMatrix.TheMatrix.help_dumpWorkflowId (   self)

Definition at line 598 of file runTheMatrix.py.

References join(), and print().

598  def help_dumpWorkflowId(self):
599  print("\n".join(["dumpWorkflowId [wfl-id1 [...]]\n",
600  "Dumps the details (cmsDriver commands for all steps) of the space-separated workflow-ids in input."]))
601 
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 498 of file runTheMatrix.py.

References join(), and print().

498  def help_predefined(self):
499  print("\n".join(["predefined [predef1 [...]]\n",
500  "Run w/o argument, it will print the list of known predefined workflows.",
501  "Run with space-separated predefined workflows, it will print the 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

◆ help_search()

def runTheMatrix.TheMatrix.help_search (   self)

Definition at line 585 of file runTheMatrix.py.

References join(), and print().

585  def help_search(self):
586  print("\n".join(["search search_regexp\n",
587  "This command will search for a match within all workflows registered.",
588  "The search is done on both the workflow name and the names of steps registered to it."]))
589 
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 550 of file runTheMatrix.py.

References join(), and print().

550  def help_searchInWorkflow(self):
551  print("\n".join(["searchInWorkflow wfl_name search_regexp\n",
552  "This command will search for a match within all workflows registered to wfl_name.",
553  "The search is done on both the workflow name and the names of steps registered to it."]))
554 
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 522 of file runTheMatrix.py.

References join(), and print().

522  def help_showWorkflow(self):
523  print("\n".join(["showWorkflow [workflow1 [...]]\n",
524  "Run w/o arguments, it will print the list of registered macro-workflows.",
525  "Run with space-separated workflows, it will print the full list of workflow-ids registered to them"]))
526 
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 625 of file runTheMatrix.py.

◆ intro

runTheMatrix.TheMatrix.intro
static

Definition at line 464 of file runTheMatrix.py.

◆ matrices_

runTheMatrix.TheMatrix.matrices_

◆ opt_

runTheMatrix.TheMatrix.opt_

Definition at line 469 of file runTheMatrix.py.

◆ prompt

runTheMatrix.TheMatrix.prompt
static

Definition at line 465 of file runTheMatrix.py.