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

Constructor & Destructor Documentation

◆ __init__()

def runTheMatrix.TheMatrix.__init__ (   self,
  opt 
)

Definition at line 387 of file runTheMatrix.py.

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

Member Function Documentation

◆ complete_predefined()

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

Definition at line 416 of file runTheMatrix.py.

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

◆ complete_searchInWorkflow()

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

Definition at line 467 of file runTheMatrix.py.

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

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

◆ complete_showWorkflow()

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

Definition at line 440 of file runTheMatrix.py.

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

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

◆ default()

def runTheMatrix.TheMatrix.default (   self,
  inp 
)

Definition at line 407 of file runTheMatrix.py.

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

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

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

◆ do_dumpWorkflowId()

def runTheMatrix.TheMatrix.do_dumpWorkflowId (   self,
  arg 
)

Definition at line 513 of file runTheMatrix.py.

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

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

◆ do_exit()

def runTheMatrix.TheMatrix.do_exit (   self,
  arg 
)

Definition at line 403 of file runTheMatrix.py.

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

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

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

References print().

◆ do_search()

def runTheMatrix.TheMatrix.do_search (   self,
  arg 
)

Definition at line 501 of file runTheMatrix.py.

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

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

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

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

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

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

◆ help_dumpWorkflowId()

def runTheMatrix.TheMatrix.help_dumpWorkflowId (   self)

Definition at line 509 of file runTheMatrix.py.

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

References join(), and print().

◆ help_predefined()

def runTheMatrix.TheMatrix.help_predefined (   self)

Definition at line 411 of file runTheMatrix.py.

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

References join(), and print().

◆ help_search()

def runTheMatrix.TheMatrix.help_search (   self)

Definition at line 496 of file runTheMatrix.py.

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

References join(), and print().

◆ help_searchInWorkflow()

def runTheMatrix.TheMatrix.help_searchInWorkflow (   self)

Definition at line 462 of file runTheMatrix.py.

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

References join(), and print().

◆ help_showWorkflow()

def runTheMatrix.TheMatrix.help_showWorkflow (   self)

Definition at line 435 of file runTheMatrix.py.

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

References join(), and print().

Member Data Documentation

◆ do_EOF

runTheMatrix.TheMatrix.do_EOF
static

Definition at line 536 of file runTheMatrix.py.

◆ intro

runTheMatrix.TheMatrix.intro
static

Definition at line 384 of file runTheMatrix.py.

◆ matrices_

runTheMatrix.TheMatrix.matrices_

◆ opt_

runTheMatrix.TheMatrix.opt_

Definition at line 389 of file runTheMatrix.py.

◆ prompt

runTheMatrix.TheMatrix.prompt
static

Definition at line 385 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:52
print
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:46
runTheMatrix.default
default
Definition: runTheMatrix.py:114