struct JobParameters
{
- //! Job Type - Could be equal to "command" or "yacs_file"
+ //! Job Type - Could be equal to "command" or "yacs_file" or "python_salome"
string job_type;
- //! YACS file
- string yacs_file;
-
- //! Command
- string command;
-
// Common values
+ string job_file;
string env_file;
FilesList in_files;
FilesList out_files;
ParserLauncherType job_params = ParseXmlFile(xmlExecuteFile);
// Creating a new job
- Launcher::Job_Command * new_job = new Launcher::Job_Command(job_params.Command);
+ Launcher::Job_Command * new_job = new Launcher::Job_Command();
+ new_job->setJobFile(job_params.Command);
new_job->setLocalDirectory(job_params.RefDirectory);
new_job->setWorkDirectory(job_params.MachinesList[clusterName].WorkDirectory);
new_job->setEnvFile(job_params.MachinesList[clusterName].EnvFile);
_launch_date = getLaunchDate();
_env_file = "";
+ _job_file = "";
+ _job_file_name = "";
_work_directory = "";
_local_directory = "";
_result_directory = "";
Launcher::Job::setMachineDefinition(const ParserResourcesType & machine_definition)
{
// Check machine_definition
+ std::string user_name = "";
if (machine_definition.UserName == "")
{
- std::string mess = "Machine definition must define a user name !, machine name is: " + machine_definition.HostName;
- throw LauncherException(mess);
+ user_name = getenv("USER");
+ if (user_name == "")
+ {
+ std::string mess = "You must define a user name: into your resource description or with env variable USER";
+ throw LauncherException(mess);
+ }
}
+ else
+ user_name = machine_definition.UserName;
_machine_definition = machine_definition;
+ _machine_definition.UserName = user_name;
}
ParserResourcesType
}
void
-Launcher::Job::setEnvFile(std::string & env_file)
+Launcher::Job::setJobFile(const std::string & job_file)
+{
+ // Check job file
+ if (job_file == "")
+ {
+ std::string mess = "Empty Job File is forbidden !";
+ throw LauncherException(mess);
+ }
+
+ _job_file = job_file;
+ std::string::size_type p1 = _job_file.find_last_of("/");
+ std::string::size_type p2 = _job_file.find_last_of(".");
+ _job_file_name = _job_file.substr(p1+1,p2-p1-1);
+ if (_job_file != "")
+ add_in_file(_job_file);
+}
+
+std::string
+Launcher::Job::getJobFile()
+{
+ return _job_file;
+}
+void
+Launcher::Job::setEnvFile(const std::string & env_file)
{
_env_file = env_file;
if (_env_file != "")
ParserResourcesType getMachineDefinition();
// Common parameters
+ virtual void setJobFile(const std::string & job_file);
void setWorkDirectory(const std::string & work_directory);
void setLocalDirectory(const std::string & local_directory);
void setResultDirectory(const std::string & result_directory);
void setMaximumDuration(const std::string & maximum_duration);
void setMachineRequiredParams(const machineParams & machine_required_params);
void setQueue(const std::string & queue);
- void setEnvFile(std::string & env_file);
+ void setEnvFile(const std::string & env_file);
+ std::string getJobFile();
std::string getWorkDirectory();
std::string getLocalDirectory();
std::string getResultDirectory();
ParserResourcesType _machine_definition;
+ std::string _job_file;
+ std::string _job_file_name;
std::string _work_directory;
std::string _local_directory;
std::string _result_directory;
#include "Launcher_Job_Command.hxx"
-Launcher::Job_Command::Job_Command(const std::string & command)
-{
- _command = command;
-}
+Launcher::Job_Command::Job_Command() {}
Launcher::Job_Command::~Job_Command() {}
-void
-Launcher::Job_Command::setCommand(const std::string & command)
-{
- _command = command;
-}
-
-std::string
-Launcher::Job_Command::getCommand()
-{
- return _command;
-}
-
void
Launcher::Job_Command::update_job()
{
#ifdef WITH_LIBBATCH
Batch::Parametre params = common_job_params();
-
- // Files
- // local file -> If file is not an absolute path, we apply _local_directory
- // remote file -> get only file name from _in_files
-
- // Copy command file
- std::string local_file;
- if (_command.substr(0, 1) == std::string("/"))
- local_file = _command;
- else
- local_file = _local_directory + "/" + _command;
- size_t found = _command.find_last_of("/");
- std::string remote_file = _work_directory + "/" + _command.substr(found+1);
- params[INFILE] += Batch::Couple(local_file, remote_file);
-
params[EXECUTABLE] = buildCommandScript(params, _launch_date);
_batch_job->setParametre(params);
#endif
std::string work_directory = params[WORKDIR].str();
// File name
- std::string::size_type p1 = _command.find_last_of("/");
- std::string::size_type p2 = _command.find_last_of(".");
- std::string command_name = _command.substr(p1+1,p2-p1-1);
- std::string command_file_name = _command.substr(p1+1);
+ std::string::size_type p1 = _job_file.find_last_of("/");
+ std::string command_file_name = _job_file.substr(p1+1);
std::string launch_date_port_file = launch_date;
- std::string launch_script = "/tmp/runCommand_" + command_name + "_" + launch_date + ".sh";
+ std::string launch_script = "/tmp/runCommand_" + _job_file_name + "_" + launch_date + ".sh";
std::ofstream launch_script_stream;
launch_script_stream.open(launch_script.c_str(), std::ofstream::out);
launch_script_stream.flush();
launch_script_stream.close();
chmod(launch_script.c_str(), 0x1ED);
- chmod(_command.c_str(), 0x1ED);
+ chmod(_job_file.c_str(), 0x1ED);
return launch_script;
}
#endif
class Job_Command : virtual public Launcher::Job
{
public:
- Job_Command(const std::string & command);
+ Job_Command();
virtual ~Job_Command();
- // Specific parameters
- void setCommand(const std::string & command);
- std::string getCommand();
-
virtual void update_job();
#ifdef WITH_LIBBATCH
protected:
std::string buildCommandScript(Batch::Parametre params, std::string launch_date);
#endif
-
- private:
- std::string _command;
};
}
--- /dev/null
+// Copyright (C) 2009 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author: André RIBES - EDF R&D
+
+#include "Launcher_Job_PythonSALOME.hxx"
+
+
+Launcher::Job_PythonSALOME::Job_PythonSALOME() {}
+
+Launcher::Job_PythonSALOME::~Job_PythonSALOME() {}
+
+void
+Launcher::Job_PythonSALOME::setJobFile(const std::string & job_file)
+{
+ Launcher::Job::setJobFile(job_file);
+}
+
+#ifdef WITH_LIBBATCH
+void
+Launcher::Job_PythonSALOME::addJobTypeSpecificScript(std::ofstream & launch_script_stream)
+{
+ launch_script_stream << _machine_definition.AppliPath << "/runSession -p $appli_port python " << _job_file_name << ".py > logs/python_" << _launch_date << ".log 2>&1" << std::endl;
+}
+#endif
+
--- /dev/null
+// Copyright (C) 2009 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author: André RIBES - EDF R&D
+
+#ifndef _LAUNCHER_JOB_PYTHONSALOME_HXX_
+#define _LAUNCHER_JOB_PYTHONSALOME_HXX_
+
+#include "Launcher_Job_SALOME.hxx"
+
+namespace Launcher
+{
+ class Job_PythonSALOME : virtual public Launcher::Job_SALOME
+ {
+ public:
+ Job_PythonSALOME();
+ virtual ~Job_PythonSALOME();
+
+ virtual void setJobFile(const std::string & job_file);
+ virtual void addJobTypeSpecificScript(std::ofstream & launch_script_stream);
+ };
+}
+
+#endif
+
+
--- /dev/null
+// Copyright (C) 2009 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author: André RIBES - EDF R&D
+
+#include "Launcher_Job_SALOME.hxx"
+
+Launcher::Job_SALOME::Job_SALOME() {}
+
+Launcher::Job_SALOME::~Job_SALOME() {}
+
+void
+Launcher::Job_SALOME::setMachineDefinition(const ParserResourcesType & machine_definition)
+{
+ // Check machine_definition
+ if (machine_definition.AppliPath == "")
+ {
+ std::string mess = "Machine definition must define an application path !, machine name is: " + machine_definition.HostName;
+ throw LauncherException(mess);
+ }
+ Launcher::Job::setMachineDefinition(machine_definition);
+}
+
+void
+Launcher::Job_SALOME::update_job()
+{
+#ifdef WITH_LIBBATCH
+ Batch::Parametre params = common_job_params();
+ params[EXECUTABLE] = buildSalomeScript(params);
+ _batch_job->setParametre(params);
+#endif
+}
+
+#ifdef WITH_LIBBATCH
+std::string
+Launcher::Job_SALOME::buildSalomeScript(Batch::Parametre params)
+{
+ // parameters
+ std::string work_directory = params[WORKDIR].str();
+
+ std::string launch_date_port_file = _launch_date;
+ std::string launch_script = "/tmp/runSalome_" + _job_file_name + "_" + _launch_date + ".sh";
+ std::ofstream launch_script_stream;
+ launch_script_stream.open(launch_script.c_str(), std::ofstream::out);
+
+ // Begin of script
+ launch_script_stream << "#! /bin/sh -f" << std::endl;
+ launch_script_stream << "cd " << work_directory << std::endl;
+ if (_env_file != "")
+ {
+ std::string::size_type last = _env_file.find_last_of("/");
+ launch_script_stream << "source ./" << _env_file.substr(last+1) << std::endl;
+ }
+ launch_script_stream << "export SALOME_TMP_DIR=" << work_directory << "/logs" << std::endl;
+
+ // -- Generates Catalog Resources
+ std::string machine_protocol = "ssh";
+ if (_machine_definition.Protocol == rsh)
+ machine_protocol = "rsh";
+
+ launch_script_stream << "if [ \"x$LIBBATCH_NODEFILE\" != \"x\" ]; then " << std::endl;
+ launch_script_stream << "CATALOG_FILE=" << work_directory << "/CatalogResources_" << _launch_date << ".xml" << std::endl;
+ launch_script_stream << "export USER_CATALOG_RESOURCES_FILE=" << "$CATALOG_FILE" << std::endl;
+ launch_script_stream << "echo '<!DOCTYPE ResourcesCatalog>' > $CATALOG_FILE" << std::endl;
+ launch_script_stream << "echo '<resources>' >> $CATALOG_FILE" << std::endl;
+ launch_script_stream << "cat $LIBBATCH_NODEFILE | sort -u | while read host" << std::endl;
+ launch_script_stream << "do" << std::endl;
+ launch_script_stream << "echo '<machine hostname='\\\"$host\\\" >> $CATALOG_FILE" << std::endl;
+ launch_script_stream << "echo ' protocol=\"" << machine_protocol << "\"' >> $CATALOG_FILE" << std::endl;
+ launch_script_stream << "echo ' userName=\"" << _machine_definition.UserName << "\"' >> $CATALOG_FILE" << std::endl;
+ launch_script_stream << "echo ' appliPath=\"" << _machine_definition.AppliPath << "\"' >> $CATALOG_FILE" << std::endl;
+ launch_script_stream << "echo '/>' >> $CATALOG_FILE" << std::endl;
+ launch_script_stream << "done" << std::endl;
+ launch_script_stream << "echo '</resources>' >> $CATALOG_FILE" << std::endl;
+ launch_script_stream << "fi" << std::endl;
+
+ // Launch SALOME with an appli
+ launch_script_stream << _machine_definition.AppliPath << "/runAppli --terminal --ns-port-log=" << launch_date_port_file << " > logs/salome_" << _launch_date << ".log 2>&1" << std::endl;
+ launch_script_stream << "current=0\n"
+ << "stop=20\n"
+ << "while ! test -f " << _machine_definition.AppliPath << "/" << launch_date_port_file << "\n"
+ << "do\n"
+ << " sleep 2\n"
+ << " let current=current+1\n"
+ << " if [ \"$current\" -eq \"$stop\" ] ; then\n"
+ << " echo Error Naming Service failed ! >&2\n"
+ << " exit\n"
+ << " fi\n"
+ << "done\n"
+ << "appli_port=`cat " << _machine_definition.AppliPath << "/" << launch_date_port_file << "`\n";
+
+ // Call real job type
+ addJobTypeSpecificScript(launch_script_stream);
+
+ // End
+ launch_script_stream << _machine_definition.AppliPath << "/runSession -p $appli_port shutdownSalome.py" << std::endl;
+
+ // Return
+ launch_script_stream.flush();
+ launch_script_stream.close();
+ chmod(launch_script.c_str(), 0x1ED);
+ return launch_script;
+}
+#endif
+
--- /dev/null
+// Copyright (C) 2009 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author: André RIBES - EDF R&D
+
+#ifndef _LAUNCHER_JOB_SALOME_HXX_
+#define _LAUNCHER_JOB_SALOME_HXX_
+
+#include "Launcher_Job.hxx"
+#include "Launcher.hxx"
+
+#ifdef WITH_LIBBATCH
+#include <Batch/Batch_Job.hxx>
+#endif
+
+namespace Launcher
+{
+ class Job_SALOME : virtual public Launcher::Job
+ {
+ public:
+ Job_SALOME();
+ virtual ~Job_SALOME();
+
+ virtual void setMachineDefinition(const ParserResourcesType & machine_definition);
+ virtual void update_job();
+
+#ifdef WITH_LIBBATCH
+ public:
+ std::string buildSalomeScript(Batch::Parametre params);
+ virtual void addJobTypeSpecificScript(std::ofstream & launch_script_stream) = 0;
+#endif
+ };
+}
+
+#endif
+
+
#include "Launcher_Job_YACSFile.hxx"
-Launcher::Job_YACSFile::Job_YACSFile(const std::string & yacs_file)
-{
- _yacs_file = yacs_file;
-}
+Launcher::Job_YACSFile::Job_YACSFile() {}
Launcher::Job_YACSFile::~Job_YACSFile() {}
-
void
-Launcher::Job_YACSFile::setYACSFile(const std::string & yacs_file)
-{
- _yacs_file = yacs_file;
-}
-
-std::string
-Launcher::Job_YACSFile::getYACSFile()
+Launcher::Job_YACSFile::setJobFile(const std::string & job_file)
{
- return _yacs_file;
-}
-
-void
-Launcher::Job_YACSFile::setMachineDefinition(const ParserResourcesType & machine_definition)
-{
- // Check machine_definition
- if (machine_definition.AppliPath == "")
- {
- std::string mess = "Machine definition must define an application path !, machine name is: " + machine_definition.HostName;
- throw LauncherException(mess);
- }
-
- Launcher::Job::setMachineDefinition(machine_definition);
+ Launcher::Job::setJobFile(job_file);
}
void
-Launcher::Job_YACSFile::update_job()
+Launcher::Job_YACSFile::addJobTypeSpecificScript(std::ofstream & launch_script_stream)
{
-#ifdef WITH_LIBBATCH
- Batch::Parametre params = common_job_params();
-
- // Adding New Files for this type of job
- // Copy YACS File
- // local file -> If file is not an absolute path, we apply _local_directory
- // remote file -> get only file name from _in_files
- std::string local_file;
- if (_yacs_file.substr(0, 1) == std::string("/"))
- local_file = _yacs_file;
- else
- local_file = _local_directory + "/" + _yacs_file;
- size_t found = _yacs_file.find_last_of("/");
- std::string remote_file = _work_directory + "/" + _yacs_file.substr(found+1);
- params[INFILE] += Batch::Couple(local_file, remote_file);
-
- params[EXECUTABLE] = buildSalomeCouplingScript(params);
-
- // Add in files -> yacs_file and launch_script
- _batch_job->setParametre(params);
-#endif
-}
-
-#ifdef WITH_LIBBATCH
-std::string
-Launcher::Job_YACSFile::buildSalomeCouplingScript(Batch::Parametre params)
-{
- // parameters
- std::string work_directory = params[WORKDIR].str();
-
- // File name
- std::string::size_type p1 = _yacs_file.find_last_of("/");
- std::string::size_type p2 = _yacs_file.find_last_of(".");
- std::string yacs_file_name = _yacs_file.substr(p1+1,p2-p1-1);
-
- std::string launch_date_port_file = _launch_date;
- std::string launch_script = "/tmp/runSalome_" + yacs_file_name + "_" + _launch_date + ".sh";
- std::ofstream launch_script_stream;
- launch_script_stream.open(launch_script.c_str(), std::ofstream::out);
-
- // Begin of script
- launch_script_stream << "#! /bin/sh -f" << std::endl;
- launch_script_stream << "cd " << work_directory << std::endl;
- if (_env_file != "")
- {
- std::string::size_type last = _env_file.find_last_of("/");
- launch_script_stream << "source ./" << _env_file.substr(last+1) << std::endl;
- }
- launch_script_stream << "export SALOME_TMP_DIR=" << work_directory << "/logs" << std::endl;
-
- // -- Generates Catalog Resources
- std::string machine_protocol = "ssh";
- if (_machine_definition.Protocol == rsh)
- machine_protocol = "rsh";
-
- launch_script_stream << "if [ \"x$LIBBATCH_NODEFILE\" != \"x\" ]; then " << std::endl;
- launch_script_stream << "CATALOG_FILE=" << work_directory << "/CatalogResources_" << _launch_date << ".xml" << std::endl;
- launch_script_stream << "export USER_CATALOG_RESOURCES_FILE=" << "$CATALOG_FILE" << std::endl;
- launch_script_stream << "echo '<!DOCTYPE ResourcesCatalog>' > $CATALOG_FILE" << std::endl;
- launch_script_stream << "echo '<resources>' >> $CATALOG_FILE" << std::endl;
- launch_script_stream << "cat $LIBBATCH_NODEFILE | sort -u | while read host" << std::endl;
- launch_script_stream << "do" << std::endl;
- launch_script_stream << "echo '<machine hostname='\\\"$host\\\" >> $CATALOG_FILE" << std::endl;
- launch_script_stream << "echo ' protocol=\"" << machine_protocol << "\"' >> $CATALOG_FILE" << std::endl;
- launch_script_stream << "echo ' userName=\"" << _machine_definition.UserName << "\"' >> $CATALOG_FILE" << std::endl;
- launch_script_stream << "echo ' appliPath=\"" << _machine_definition.AppliPath << "\"' >> $CATALOG_FILE" << std::endl;
- launch_script_stream << "echo '/>' >> $CATALOG_FILE" << std::endl;
- launch_script_stream << "done" << std::endl;
- launch_script_stream << "echo '</resources>' >> $CATALOG_FILE" << std::endl;
- launch_script_stream << "fi" << std::endl;
-
- // Launch SALOME with an appli
- launch_script_stream << _machine_definition.AppliPath << "/runAppli --terminal --ns-port-log=" << launch_date_port_file << " > logs/salome_" << _launch_date << ".log 2>&1" << std::endl;
- launch_script_stream << "current=0\n"
- << "stop=20\n"
- << "while ! test -f " << _machine_definition.AppliPath << "/" << launch_date_port_file << "\n"
- << "do\n"
- << " sleep 2\n"
- << " let current=current+1\n"
- << " if [ \"$current\" -eq \"$stop\" ] ; then\n"
- << " echo Error Naming Service failed ! >&2\n"
- << " exit\n"
- << " fi\n"
- << "done\n"
- << "appli_port=`cat " << _machine_definition.AppliPath << "/" << launch_date_port_file << "`\n";
- launch_script_stream << _machine_definition.AppliPath << "/runSession -p $appli_port driver " << yacs_file_name << ".xml > logs/yacs_" << _launch_date << ".log 2>&1" << std::endl;
- launch_script_stream << _machine_definition.AppliPath << "/runSession -p $appli_port shutdownSalome.py" << std::endl;
-
- // Return
- launch_script_stream.flush();
- launch_script_stream.close();
- chmod(launch_script.c_str(), 0x1ED);
- return launch_script;
+ launch_script_stream << _machine_definition.AppliPath << "/runSession -p $appli_port driver " << _job_file_name << ".xml > logs/yacs_" << _launch_date << ".log 2>&1" << std::endl;
}
-#endif
#ifndef _LAUNCHER_JOB_YACSFILE_HXX_
#define _LAUNCHER_JOB_YACSFILE_HXX_
-#include "Launcher_Job.hxx"
-#include "Launcher.hxx"
-
-#ifdef WITH_LIBBATCH
-#include <Batch/Batch_Job.hxx>
-#endif
+#include "Launcher_Job_SALOME.hxx"
namespace Launcher
{
- class Job_YACSFile : virtual public Launcher::Job
+ class Job_YACSFile : virtual public Launcher::Job_SALOME
{
public:
- Job_YACSFile(const std::string & yacs_file);
+ Job_YACSFile();
virtual ~Job_YACSFile();
- // Specific parameters
- void setYACSFile(const std::string & yacs_file);
- std::string getYACSFile();
-
- virtual void setMachineDefinition(const ParserResourcesType & machine_definition);
-
- virtual void update_job();
-
-#ifdef WITH_LIBBATCH
- protected:
- std::string buildSalomeCouplingScript(Batch::Parametre params);
-#endif
-
- private:
- std::string _yacs_file;
+ virtual void setJobFile(const std::string & job_file);
+ virtual void addJobTypeSpecificScript(std::ofstream & launch_script_stream);
};
}
Launcher_Utils.hxx \
Launcher_Job.hxx \
Launcher_Job_Command.hxx \
+ Launcher_Job_SALOME.hxx \
+ Launcher_Job_PythonSALOME.hxx \
Launcher_Job_YACSFile.hxx \
Launcher.hxx
Launcher_Utils.hxx \
Launcher_Job.cxx \
Launcher_Job_Command.cxx \
+ Launcher_Job_SALOME.cxx \
+ Launcher_Job_PythonSALOME.cxx \
Launcher_Job_YACSFile.cxx \
Launcher.cxx
#include "Launcher_Job_Command.hxx"
#include "Launcher_Job_YACSFile.hxx"
+#include "Launcher_Job_PythonSALOME.hxx"
#ifdef WIN32
# include <process.h>
{
std::string job_type = job_parameters.job_type.in();
- if (job_type != "command" and job_type != "yacs_file")
+ if (job_type != "command" and job_type != "yacs_file" and job_type != "python_salome")
{
std::string message("SALOME_Launcher::createJob: bad job type: ");
message += job_type;
Launcher::Job * new_job; // It is Launcher_cpp that is going to destroy it
if (job_type == "command")
- {
- std::string command = job_parameters.command.in();
- if (command == "")
- {
- std::string message("SALOME_Launcher::createJob: command is empty !");
- THROW_SALOME_CORBA_EXCEPTION(message.c_str(), SALOME::INTERNAL_ERROR);
- }
- Launcher::Job_Command * job = new Launcher::Job_Command(command);
- new_job = job;
- }
+ new_job = new Launcher::Job_Command();
else if (job_type == "yacs_file")
- {
- std::string yacs_file = job_parameters.yacs_file.in();
- if (yacs_file == "")
- {
- std::string message("SALOME_Launcher::createJob: yacs_file is empty !");
- THROW_SALOME_CORBA_EXCEPTION(message.c_str(), SALOME::INTERNAL_ERROR);
- }
- new_job = new Launcher::Job_YACSFile(yacs_file);
- }
+ new_job = new Launcher::Job_YACSFile();
+ else if (job_type == "python_salome")
+ new_job = new Launcher::Job_PythonSALOME();
// Directories
std::string work_directory = job_parameters.work_directory.in();
new_job->setLocalDirectory(local_directory);
new_job->setResultDirectory(result_directory);
+ // Job File
+ std::string job_file = job_parameters.job_file.in();
+ try
+ {
+ new_job->setJobFile(job_file);
+ }
+ catch(const LauncherException &ex)
+ {
+ INFOS(ex.msg.c_str());
+ THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(),SALOME::INTERNAL_ERROR);
+ }
+
// Files
std::string env_file = job_parameters.env_file.in();
new_job->setEnvFile(env_file);