CMS 3D CMS Logo

Functions
GetScenario Namespace Reference

Functions

def getScenario (scenarioName)
 

Detailed Description

_GetScenario_

Util to retrieve a Scenario implementation
Searches Impl directory for the named scenario and imports it

Function Documentation

def GetScenario.getScenario (   scenarioName)
_getScenario_

Util to load the scenario implementation.

Assumes that module exists at:

Configuration.DataProcessing.Impl.<scenarioName>.py

Definition at line 12 of file GetScenario.py.

References instance, and harvestTrackValidationPlots.str.

12 def getScenario(scenarioName):
13  """
14  _getScenario_
15 
16  Util to load the scenario implementation.
17 
18  Assumes that module exists at:
19 
20  Configuration.DataProcessing.Impl.<scenarioName>.py
21 
22  """
23  moduleName = "Configuration.DataProcessing.Impl.%s" % scenarioName
24  try:
25  module = __import__(moduleName,
26  globals(), locals(), [scenarioName])#, -1)
27  except ImportError as ex:
28  msg = "Unable to load Scenario Module:\n"
29  msg += "%s\n%s\n" % (moduleName, str(ex))
30  raise RuntimeError(msg)
31  instance = getattr(module, scenarioName, None)
32  if instance == None:
33  msg = "Unable to retrieve instance of Scenario class:"
34  msg += "%s\n From Module\n%s" % (scenarioName, moduleName)
35  return instance()
36 
37 
38 
static PFTauRenderPlugin instance
def getScenario(scenarioName)
Definition: GetScenario.py:12