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

Constructor & Destructor Documentation

◆ __init__()

def runTheMatrix.TheMatrix.__init__ (   self,
  opt 
)

Definition at line 465 of file runTheMatrix.py.

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

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

◆ complete_searchInWorkflow()

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

Definition at line 553 of file runTheMatrix.py.

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

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

◆ complete_showWorkflow()

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

Definition at line 525 of file runTheMatrix.py.

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

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

◆ default()

def runTheMatrix.TheMatrix.default (   self,
  inp 
)

Definition at line 486 of file runTheMatrix.py.

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

486  def default(self, inp):
487  if inp == 'x' or inp == 'q':
488  return self.do_exit(inp)
489  else:
490  is_pipe = not isatty(sys.stdin.fileno())
491  print(Fore.RED + "Error: " + Fore.RESET + "unrecognized command.")
492  # Quit only if given a piped command.
493  if is_pipe:
494  sys.exit(1)
495 
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 478 of file runTheMatrix.py.

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

◆ do_dumpWorkflowId()

def runTheMatrix.TheMatrix.do_dumpWorkflowId (   self,
  arg 
)

Definition at line 600 of file runTheMatrix.py.

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

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

References print().

Referenced by runTheMatrix.TheMatrix.default().

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

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

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

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

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

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

Referenced by runTheMatrix.TheMatrix.do_search().

559  def do_searchInWorkflow(self, arg):
560  args = arg.split()
561  if len(args) < 2:
562  print("searchInWorkflow name regexp")
563  return
564  if args[0] not in self.matrices_.keys():
565  print("Unknown workflow")
566  return
567  import re
568  pattern = None
569  try:
570  pattern = re.compile(args[1])
571  except:
572  print("Failed to compile regexp %s" % args[1])
573  return
574  counter = 0
575  for wfl in self.matrices_[args[0]].workFlows:
576  if re.match(pattern, wfl.nameId):
577  print("%s %s" % (Fore.BLUE + str(wfl.numId) + Fore.RESET,
578  Fore.GREEN + wfl.nameId + Fore.RESET))
579  counter +=1
580  print("Found %s compatible workflows inside %s" % (Fore.RED + str(counter) + Fore.RESET,
581  Fore.YELLOW + str(args[0])) + Fore.RESET)
582 
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 531 of file runTheMatrix.py.

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

531  def do_showWorkflow(self, arg):
532  if arg == '':
533  print("Available workflows:")
534  for k in self.matrices_.keys():
535  print(Fore.RED + Style.BRIGHT + k)
536  print(Style.RESET_ALL)
537  else:
538  selected = arg.split()
539  for k in selected:
540  if k not in self.matrices_.keys():
541  print("Unknown workflow %s: skipping" % k)
542  else:
543  for wfl in self.matrices_[k].workFlows:
544  print("%s %s" % (Fore.BLUE + str(wfl.numId) + Fore.RESET,
545  Fore.GREEN + wfl.nameId + Fore.RESET))
546  print("%s contains %d workflows" % (Fore.RED + k + Fore.RESET, len(self.matrices_[k].workFlows)))
547 
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 596 of file runTheMatrix.py.

References join(), and print().

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

References join(), and print().

496  def help_predefined(self):
497  print("\n".join(["predefined [predef1 [...]]\n",
498  "Run w/o argument, it will print the list of known predefined workflows.",
499  "Run with space-separated predefined workflows, it will print the workflow-ids registered to them"]))
500 
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 583 of file runTheMatrix.py.

References join(), and print().

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

References join(), and print().

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

References join(), and print().

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

◆ intro

runTheMatrix.TheMatrix.intro
static

Definition at line 462 of file runTheMatrix.py.

◆ matrices_

runTheMatrix.TheMatrix.matrices_

◆ opt_

runTheMatrix.TheMatrix.opt_

Definition at line 467 of file runTheMatrix.py.

◆ prompt

runTheMatrix.TheMatrix.prompt
static

Definition at line 463 of file runTheMatrix.py.