};
%pythoncode %{
-def SendJobToSession(self, job_id, sessionId):
+def sendJobToSession(self, job_id, sessionId=None):
+ """Send job specified by its job_id in self to a remote SALOME session.
+ Doing so, it's possible to follow the job created locally into the JobManager module of the target SALOME session.
+ SALOME session is specified by the file pointed by the content of OMNIORB_CONFIG environement var. The content of this var is called sessionId.
+ If sessionId is let untouched, the current OMNIORB_CONFIG environement var is used.
+ If this method fails to connect to the target SALOME session a RuntimeError exception will be thrown.
+ """
def job_type_traducer(jyf):
dico = {'Job_YACSFile' : 'yacs_file'}
st = type(jyf).__name__
filest = self.dumpJob(job_id);
# Connect to SALOME session a retrieve its SalomeLauncher object
import os
- os.environ["OMNIORB_CONFIG"]=sessionId
+ if sessionId is not None:
+ os.environ["OMNIORB_CONFIG"]=sessionId
import Engines
import orbmodule
- clt=orbmodule.client()
- sl = clt.Resolve("SalomeLauncher")
+ try:
+ clt=orbmodule.client()
+ sl = clt.Resolve("SalomeLauncher")
+ except:
+ raise RuntimeError("Fail to connect to the remote SALOME session.")
# swig to CORBA translation
# Job_YACSFile -> Engines.JobParameters and resourceParams -> Engines.ResourceParameters()
l21= [('job_name', None), ('job_type', job_type_traducer), ('job_file', None), ('pre_command', None), ('env_file', None), ('in_files', lambda x: x.get_in_files()), ('out_files', lambda x: x.get_out_files()), ('work_directory', None), ('local_directory', None), ('result_directory', None), ('maximum_duration', None), ('resource_required',resource_required_func) , ('queue', None), ('partition', None), ('exclusive', None), ('mem_per_cpu', None), ('wckey', lambda x: x.getWCKey() ), ('extra_params', None), ('specific_parameters', lambda x: list(x.getSpecificParameters().items())), ('launcher_file', None), ('launcher_args', None)]
bpc = sl.createJob(jyc)
sl.restoreJob(filest)
-Launcher_cpp.sendJobToSession = SendJobToSession
-del SendJobToSession
+Launcher_cpp.sendJobToSession = sendJobToSession
+del sendJobToSession
%}
import pylauncher as pyla
jyf=pyla.Job_YACSFile()
jyf.setJobName("YDFX")
-jyf.setWorkDirectory("/scratch/H87074/Example")
-jyf.setLocalDirectory("/home/H87074/Example")
-jyf.setResultDirectory("/home/H87074/Example")
+jyf.setWorkDirectory("/scratch/geay/Example")
+jyf.setLocalDirectory("/home/geay/Example")
+jyf.setResultDirectory("/home/geay/Example")
jyf.setLauncherFile("")
jyf.setLauncherArgs("")
-jyf.setJobFile("/tmp/EvalYFX_H87074_180119_093600.xml") # schema YACS
+jyf.setJobFile("/tmp/EvalYFX_geay_180119_093600.xml") # schema YACS
jyf.setPreCommand("")
jyf.setEnvFile("")
for elt in []:
jyf.add_in_file(elt)
-for elt in ["EvalYFX_H87074_180119_093600"]:
+for elt in ["EvalYFX_geay_180119_093600"]:
jyf.add_out_file(elt)
jyf.setMaximumDuration("00:05")
jyf.setQueue("")
jyf.setResourceRequiredParams(rp)
jyf.checkSpecificParameters()
l = pyla.Launcher_cpp()
-res = pyla.ResourcesManager_cpp("/home/H87074/salome/V9_DEV/appli_V9_2_0/CatalogResources.xml")
+res = pyla.ResourcesManager_cpp("/home/geay/salome/V9_DEV/appli_V9_2_0/CatalogResources.xml")
l.SetResourcesManager(res)
l.createJob(jyf)
nb=jyf.getNumber()
l.launchJob(nb)
-l.getJobState(nb)
+l.sendJobToSession(nb)
+#l.getJobState(nb)
#l.getJobResults(nb,jyf.getLocalDirectory())