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

Constructor & Destructor Documentation

◆ __init__()

def runTheMatrix.TheMatrix.__init__ (   self,
  opt 
)

Definition at line 388 of file runTheMatrix.py.

388  def __init__(self, opt):
389  cmd.Cmd.__init__(self)
390  self.opt_ = opt
391  self.matrices_ = {}
392  tmp = MatrixReader(self.opt_)
393  for what in tmp.files:
394  self.opt_.what = what
395  self.matrices_[what] = MatrixReader(self.opt_)
396  self.matrices_[what].prepare(self.opt_.useInput, self.opt_.refRel,
397  self.opt_.fromScratch)
398  os.system("clear")
399 

Member Function Documentation

◆ complete_predefined()

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

Definition at line 417 of file runTheMatrix.py.

417  def complete_predefined(self, text, line, start_idx, end_idx):
418  if text and len(text) > 0:
419  return [t for t in predefinedSet.keys() if t.startswith(text)]
420  else:
421  return predefinedSet.keys()
422 

◆ complete_searchInWorkflow()

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

Definition at line 468 of file runTheMatrix.py.

468  def complete_searchInWorkflow(self, text, line, start_idx, end_idx):
469  if text and len(text) > 0:
470  return [t for t in self.matrices_.keys() if t.startswith(text)]
471  else:
472  return self.matrices_.keys()
473 

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

◆ complete_showWorkflow()

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

Definition at line 441 of file runTheMatrix.py.

441  def complete_showWorkflow(self, text, line, start_idx, end_idx):
442  if text and len(text) > 0:
443  return [t for t in self.matrices_.keys() if t.startswith(text)]
444  else:
445  return self.matrices_.keys()
446 

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

◆ default()

def runTheMatrix.TheMatrix.default (   self,
  inp 
)

Definition at line 408 of file runTheMatrix.py.

408  def default(self, inp):
409  if inp == 'x' or inp == 'q':
410  return self.do_exit(inp)
411 

References runTheMatrix.TheMatrix.do_exit().

◆ do_clear()

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

Definition at line 400 of file runTheMatrix.py.

400  def do_clear(self, arg):
401  """Clear the screen, put prompt at the top"""
402  os.system("clear")
403 

◆ do_dumpWorkflowId()

def runTheMatrix.TheMatrix.do_dumpWorkflowId (   self,
  arg 
)

Definition at line 514 of file runTheMatrix.py.

514  def do_dumpWorkflowId(self, arg):
515  wflids = arg.split()
516  if len(wflids) == 0:
517  print("dumpWorkflowId [wfl-id1 [...]]")
518  return
519 
520  fmt = "[%d]: %s\n"
521  maxLen = 100
522  for wflid in wflids:
523  dump = True
524  for key, mrd in self.matrices_.iteritems():
525  for wfl in mrd.workFlows:
526  if wfl.numId == float(wflid):
527  wfName, stepNames = wfl.nameId.split('+',1)
528  if dump:
529  dump = False
530  print(wfl.numId, stepNames)
531  for i,s in enumerate(wfl.cmds):
532  print(fmt % (i+1, (str(s)+' ')))
533  print("\nWorkflow found in %s." % key)
534  else:
535  print("Workflow also found in %s." % key)
536 

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

◆ do_exit()

def runTheMatrix.TheMatrix.do_exit (   self,
  arg 
)

Definition at line 404 of file runTheMatrix.py.

404  def do_exit(self, arg):
405  print("Leaving the Matrix")
406  return True
407 

References print().

Referenced by runTheMatrix.TheMatrix.default().

◆ do_predefined()

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

Definition at line 423 of file runTheMatrix.py.

423  def do_predefined(self, arg):
424  """Print the list of predefined workflows"""
425  print("List of predefined workflows")
426  if arg:
427  for w in arg.split():
428  if w in predefinedSet.keys():
429  print("Predefined Set: %s" % w)
430  print(predefinedSet[w])
431  else:
432  print("Unknown Set: %s" % w)
433  else:
434  print(predefinedSet.keys())
435 

References print().

◆ do_search()

def runTheMatrix.TheMatrix.do_search (   self,
  arg 
)

Definition at line 502 of file runTheMatrix.py.

502  def do_search(self, arg):
503  args = arg.split()
504  if len(args) < 1:
505  print("search regexp")
506  return
507  for wfl in self.matrices_.keys():
508  self.do_searchInWorkflow(' '.join([wfl, args[0]]))
509 

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

◆ do_searchInWorkflow()

def runTheMatrix.TheMatrix.do_searchInWorkflow (   self,
  arg 
)

Definition at line 474 of file runTheMatrix.py.

474  def do_searchInWorkflow(self, arg):
475  args = arg.split()
476  if len(args) < 2:
477  print("searchInWorkflow name regexp")
478  return
479  if args[0] not in self.matrices_.keys():
480  print("Unknown workflow")
481  return
482  import re
483  pattern = None
484  try:
485  pattern = re.compile(args[1])
486  except:
487  print("Failed to compile regexp %s" % args[1])
488  return
489  counter = 0
490  for wfl in self.matrices_[args[0]].workFlows:
491  wfName, stepNames = wfl.nameId.split('+',1)
492  if re.match(pattern, wfName) or re.match(pattern, stepNames):
493  print("%s %s %s" % (wfl.numId, wfName, stepNames))
494  counter += 1
495  print("Found %d compatible workflows inside %s" % (counter, args[0]))
496 

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

Referenced by runTheMatrix.TheMatrix.do_search().

◆ do_showWorkflow()

def runTheMatrix.TheMatrix.do_showWorkflow (   self,
  arg 
)

Definition at line 447 of file runTheMatrix.py.

447  def do_showWorkflow(self, arg):
448  if arg == '':
449  print("Available workflows:")
450  for k in self.matrices_.keys():
451  print(k)
452  else:
453  selected = arg.split()
454  for k in selected:
455  if k not in self.matrices_.keys():
456  print("Unknown workflow %s: skipping" % k)
457  else:
458  for wfl in self.matrices_[k].workFlows:
459  wfName, stepNames = wfl.nameId.split('+',1)
460  print("%s %s %s" % (wfl.numId, wfName, stepNames))
461  print("%s contains %d workflows" % (k, len(self.matrices_[k].workFlows)))
462 

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

◆ help_dumpWorkflowId()

def runTheMatrix.TheMatrix.help_dumpWorkflowId (   self)

Definition at line 510 of file runTheMatrix.py.

510  def help_dumpWorkflowId(self):
511  print("\n".join(["dumpWorkflowId [wfl-id1 [...]]\n",
512  "Dumps the details (cmsDriver commands for all steps) of the space-separated workflow-ids in input."]))
513 

References join(), and print().

◆ help_predefined()

def runTheMatrix.TheMatrix.help_predefined (   self)

Definition at line 412 of file runTheMatrix.py.

412  def help_predefined(self):
413  print("\n".join(["predefined [predef1 [...]]\n",
414  "Run w/o argument, it will print the list of known predefined workflows.",
415  "Run with space-separated predefined workflows, it will print the workflow-ids registered to them"]))
416 

References join(), and print().

◆ help_search()

def runTheMatrix.TheMatrix.help_search (   self)

Definition at line 497 of file runTheMatrix.py.

497  def help_search(self):
498  print("\n".join(["search search_regexp\n",
499  "This command will search for a match within all workflows registered.",
500  "The search is done on both the workflow name and the names of steps registered to it."]))
501 

References join(), and print().

◆ help_searchInWorkflow()

def runTheMatrix.TheMatrix.help_searchInWorkflow (   self)

Definition at line 463 of file runTheMatrix.py.

463  def help_searchInWorkflow(self):
464  print("\n".join(["searchInWorkflow wfl_name search_regexp\n",
465  "This command will search for a match within all workflows registered to wfl_name.",
466  "The search is done on both the workflow name and the names of steps registered to it."]))
467 

References join(), and print().

◆ help_showWorkflow()

def runTheMatrix.TheMatrix.help_showWorkflow (   self)

Definition at line 436 of file runTheMatrix.py.

436  def help_showWorkflow(self):
437  print("\n".join(["showWorkflow [workflow1 [...]]\n",
438  "Run w/o arguments, it will print the list of registered macro-workflows.",
439  "Run with space-separated workflows, it will print the full list of workflow-ids registered to them"]))
440 

References join(), and print().

Member Data Documentation

◆ do_EOF

runTheMatrix.TheMatrix.do_EOF
static

Definition at line 537 of file runTheMatrix.py.

◆ intro

runTheMatrix.TheMatrix.intro
static

Definition at line 385 of file runTheMatrix.py.

◆ matrices_

runTheMatrix.TheMatrix.matrices_

◆ opt_

runTheMatrix.TheMatrix.opt_

Definition at line 390 of file runTheMatrix.py.

◆ prompt

runTheMatrix.TheMatrix.prompt
static

Definition at line 386 of file runTheMatrix.py.

MatrixReader
Definition: MatrixReader.py:1
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
join
static std::string join(char **cmd)
Definition: RemoteFile.cc:17
relativeConstraints.keys
keys
Definition: relativeConstraints.py:89
str
#define str(s)
Definition: TestProcessor.cc:53
print
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:46
runTheMatrix.default
default
Definition: runTheMatrix.py:115