예제 #1
0
    def __init__(self,
                 messageHandler,
                 ppserver,
                 args,
                 functionToRun,
                 frameworkModules=[],
                 identifier=None,
                 metadata=None,
                 functionToSkip=None,
                 uniqueHandler="any",
                 profile=False):
        """
      Init method
      @ In, messageHandler, MessageHandler object, the global RAVEN message
        handler object
      @ In, ppserver, ppserver, instance of the ppserver object
      @ In, args, dict, this is a list of arguments that will be passed as
        function parameters into whatever method is stored in functionToRun.
        e.g., functionToRun(*args)
      @ In, functionToRun, method or function, function that needs to be run
      @ In, frameworkModules, list, optional, list of modules that need to be
        imported for internal parallelization (parallel python). This list
        should be generated with the method returnImportModuleString in utils.py
      @ In, identifier, string, optional, id of this job
      @ In, metadata, dict, optional, dictionary of metadata associated with
        this run
      @ In, functionToSkip, list, optional, list of functions, classes and
        modules that need to be skipped in pickling the function dependencies
      @ In, forceUseThreads, bool, optional, flag that, if True, is going to
        force the usage of multi-threading even if parallel python is activated
      @ In, uniqueHandler, string, optional, it is a special keyword attached to
        this runner. For example, if present, to retrieve this runner using the
        method jobHandler.getFinished, the uniqueHandler needs to be provided.
        If uniqueHandler == 'any', every "client" can get this runner
      @ In, profile, bool, optional, if True then timing statements are printed
        during deconstruction.
      @ Out, None
    """

        ## First, allow the base class to handle the commonalities
        ##   We keep the command here, in order to have the hook for running exec
        ##   code into internal models
        super(DistributedMemoryRunner,
              self).__init__(messageHandler, args, functionToRun, identifier,
                             metadata, uniqueHandler, profile)

        ## Just in case, remove duplicates before storing to save on computation
        ## later
        self.frameworkMods = utils.removeDuplicates(frameworkModules)
        self.functionToSkip = utils.removeDuplicates(functionToSkip)
        self.args = args

        ## Other parameters passed at initialization
        self.__ppserver = ppserver
예제 #2
0
파일: Driver.py 프로젝트: HCBINL/raven
    """This is the main driver for the RAVEN framework"""
    # Retrieve the framework directory path and working dir

    printLogo()
    printStatement()

    checkVersions()

    verbosity = 'all'
    interfaceCheck = False
    interactive = Interaction.No
    workingDir = os.getcwd()

    ## Remove duplicate command line options and preserve order so if they try
    ## conflicting options, the last one will take precedence.
    sys.argv = utils.removeDuplicates(sys.argv)

    itemsToRemove = []
    for item in sys.argv:
        # I don't think these do anything.  - talbpaul, 2017-10
        if item.lower() in ['silent', 'quiet', 'all']:
            verbosity = item.lower()
            itemsToRemove.append(item)
        elif item.lower() == 'interfacecheck':
            interfaceCheck = True
            itemsToRemove.append(item)
        elif item.lower() == 'interactive':
            if __QtAvailable:
                interactive = Interaction.Yes
            else:
                print('Qt is not available, disabling interactive mode.\n')