diff --git a/framework/CodeInterfaces/Generic/GenericCodeInterface.py b/framework/CodeInterfaces/Generic/GenericCodeInterface.py index b11aa32621..f5c034ac5d 100644 --- a/framework/CodeInterfaces/Generic/GenericCodeInterface.py +++ b/framework/CodeInterfaces/Generic/GenericCodeInterface.py @@ -182,5 +182,5 @@ def createNewInput(self,currentInputFiles,origInputFiles,samplerType,**Kwargs): origfiles.append(inputFile) parser = GenericParser.GenericParser(infiles) parser.modifyInternalDictionary(**Kwargs) - parser.writeNewInput(currentInputFiles,origfiles) + parser.writeNewInput(infiles,origfiles) return currentInputFiles diff --git a/framework/Models/Code.py b/framework/Models/Code.py index 53ff72d807..c6e3605461 100644 --- a/framework/Models/Code.py +++ b/framework/Models/Code.py @@ -848,8 +848,8 @@ def submit(self, myInput, samplerType, jobHandler, **kwargs): a mandatory key is the sampledVars'that contains a dictionary {'name variable':value} @ Out, None """ - prefix = kwargs['prefix'] if 'prefix' in kwargs else None - uniqueHandler = kwargs['uniqueHandler'] if 'uniqueHandler' in kwargs.keys() else 'any' + prefix = kwargs.get("prefix") + uniqueHandler = kwargs.get("uniqueHandler",'any') ## These two are part of the current metadata, so they will be added before ## the job is started, so that they will be captured in the metadata and match diff --git a/framework/Models/Model.py b/framework/Models/Model.py index e6564b0c8b..1d5d258a85 100644 --- a/framework/Models/Model.py +++ b/framework/Models/Model.py @@ -369,8 +369,9 @@ def submit(self, myInput, samplerType, jobHandler, **kwargs): a mandatory key is the sampledVars'that contains a dictionary {'name variable':value} @ Out, None """ - prefix = kwargs['prefix'] if 'prefix' in kwargs else None - uniqueHandler = kwargs['uniqueHandler'] if 'uniqueHandler' in kwargs.keys() else 'any' + prefix = kwargs.get("prefix") + uniqueHandler = kwargs.get("uniqueHandler",'any') + forceThreads = kwargs.get("forceThreads",False) ## These kwargs are updated by createNewInput, so the job either should not ## have access to the metadata, or it needs to be updated from within the @@ -382,37 +383,7 @@ def submit(self, myInput, samplerType, jobHandler, **kwargs): ## works, we are unable to pass a member function as a job because the ## pp library loses track of what self is, so instead we call it from the ## class and pass self in as the first parameter - jobHandler.addJob((self, myInput, samplerType, kwargs), self.__class__.evaluateSample, prefix, metadata=metadata, modulesToImport=self.mods, uniqueHandler=uniqueHandler) - - def submitAsClient(self, myInput, samplerType, jobHandler, **kwargs): - """ - This will submit an individual sample to be evaluated by this model to a - specified jobHandler as a client job. Note, some parameters are needed - by createNewInput and thus descriptions are copied from there. - @ In, myInput, list, the inputs (list) to start from to generate the new - one - @ In, samplerType, string, is the type of sampler that is calling to - generate a new input - @ In, jobHandler, JobHandler instance, the global job handler instance - @ In, **kwargs, dict, is a dictionary that contains the information - coming from the sampler, a mandatory key is the sampledVars' that - contains a dictionary {'name variable':value} - @ Out, None - """ - prefix = kwargs['prefix'] if 'prefix' in kwargs else None - uniqueHandler = kwargs['uniqueHandler'] if 'uniqueHandler' in kwargs.keys() else 'any' - - ## These kwargs are updated by createNewInput, so the job either should not - ## have access to the metadata, or it needs to be updated from within the - ## evaluateSample function, which currently is not possible since that - ## function does not know about the job instance. - metadata = kwargs - - ## This may look a little weird, but due to how the parallel python library - ## works, we are unable to pass a member function as a job because the - ## pp library loses track of what self is, so instead we call it from the - ## class and pass self in as the first parameter - jobHandler.addClientJob((self, myInput, samplerType, kwargs), self.__class__.evaluateSample, prefix, metadata=metadata, modulesToImport=self.mods, uniqueHandler=uniqueHandler) + jobHandler.addJob((self, myInput, samplerType, kwargs), self.__class__.evaluateSample, prefix, metadata=metadata, modulesToImport=self.mods, uniqueHandler=uniqueHandler, forceUseThreads=forceThreads) def addOutputFromExportDictionary(self,exportDict,output,options,jobIdentifier): """ diff --git a/framework/Models/PostProcessor.py b/framework/Models/PostProcessor.py index 6db5169f06..88929a52bf 100644 --- a/framework/Models/PostProcessor.py +++ b/framework/Models/PostProcessor.py @@ -203,12 +203,8 @@ def submit(self,myInput,samplerType,jobHandler,**kwargs): a mandatory key is the sampledVars'that contains a dictionary {'name variable':value} @ Out, None """ - - ## This may look a little weird, but due to how the parallel python library - ## works, we are unable to pass a member function as a job because the - ## pp library loses track of what self is, so instead we call it from the - ## class and pass self in as the first parameter - jobHandler.addJob((self, myInput, samplerType, kwargs), self.__class__.evaluateSample, str(0), modulesToImport=self.mods, forceUseThreads=True) + kwargs['forceThreads'] = True + Model.submit(self,myInput, samplerType, jobHandler,**kwargs) def evaluateSample(self, myInput, samplerType, kwargs): """ diff --git a/tests/framework/CodeInterfaceTests/GenericInterface/inp.three b/tests/framework/CodeInterfaceTests/GenericInterface/inp.three new file mode 100644 index 0000000000..7569a8b9c5 --- /dev/null +++ b/tests/framework/CodeInterfaceTests/GenericInterface/inp.three @@ -0,0 +1,5 @@ + + + 10 + 1 + diff --git a/tests/framework/CodeInterfaceTests/test_generic_interface.xml b/tests/framework/CodeInterfaceTests/test_generic_interface.xml index 6d2987fdb1..727810e58d 100644 --- a/tests/framework/CodeInterfaceTests/test_generic_interface.xml +++ b/tests/framework/CodeInterfaceTests/test_generic_interface.xml @@ -26,6 +26,7 @@ one.xml inp.two + inp.three dummy.e dummy_file_for_subdirectory.dummy @@ -36,6 +37,7 @@ + @@ -68,6 +70,7 @@ inp.two one.xml + inp.three mesh a_dummy_file_for_subdirectory poly