# Copy the commun files to the root work directory
params = pydefx.Parameters() # global parameters
params.loadDict(self.config["params"])
- # use a fake empty command
+ # use a fake empty command.
+ # Using launcher to copy some files on the remote file system,
+ # without launching a job.
command = os.path.join(os.getcwd(), "empty.sh")
open(command, "w").close()
params.salome_parameters.job_file = command
study_module = "idefixstudy.py"
error_result = "idefixerror.txt"
value_result = "idefixresult.txt"
+traceback_result = "idefixtraceback.txt"
with open(data_file_name, "r") as f:
values = f.read()
result = _exec(**inputvals)
except Exception as e:
error=str(e)
- traceback.print_exc()
+ os.chdir(old_dir) # back to the current case job directory
+ with open(traceback_result, "w") as f:
+ traceback.print_exc(file=f)
os.chdir(old_dir) # back to the current case job directory
class MultiJobStudy(pystudy.PyStudy):
+ """
+ This study uses one different job for each evaluation.
+ """
def __init__(self, sampleManager=None, schemaBuilder=None):
if schemaBuilder is None:
schemaBuilder = multijobbuilder.MultiJobBuilder()
job_string = loadJobString(path)
launcher = salome_proxy.getLauncher()
self.job_id = launcher.restoreJob(job_string)
- if job_id >= 0:
- salome_params = launcher.getJobParameters(job_id)
+ if self.job_id >= 0:
+ salome_params = launcher.getJobParameters(self.job_id)
self.params = parameters.Parameters(salome_parameters=salome_params)
self.getResult()
return self.job_id
raise StudyUseException("Parameter {} not found in the sample.".format(nm))
### Deprecated!!!!
-def dumpJob(result_directory, jobString):
- """
- Save the jobString to a file into result_directory.
- result_directory is a string representing a path to a directory.
- jobString is a string representing the serialization of a job.
- Use loadJobString for reloading the string saved here.
- """
- jobDumpPath = os.path.join(result_directory, PyStudy.JOB_DUMP_NAME)
- with open(jobDumpPath, "w") as f:
- f.write(job_string)
-
def loadJobString(result_directory):
"""
Return the jobString saved by the dumpJob function into a directory.
- Use dumpJob for saving a the string.
+ Use dumpJob for saving the string.
"""
jobDumpPath = os.path.join(result_directory, PyStudy.JOB_DUMP_NAME)
with open(jobDumpPath, "r") as f: