const int SALOME_ContainerManager::TIME_OUT_TO_LAUNCH_CONT=60;
-const char *SALOME_ContainerManager::_ContainerManagerNameInNS =
+const char *SALOME_ContainerManager::_ContainerManagerNameInNS =
"/ContainerManager";
omni_mutex SALOME_ContainerManager::_numInstanceMutex;
Utils_Mutex SALOME_ContainerManager::_systemMutex;
//=============================================================================
-/*!
+/*!
* Constructor
* \param orb
* Define a CORBA single thread policy for the server, which avoid to deal
_pid_mpiServer = -1;
// the urifile name depends on pid of the process
std::stringstream urifile;
- urifile << GetenvThreadSafe("HOME") << "/.urifile_" << getpid();
+ urifile << GetenvThreadSafeAsString("HOME") << "/.urifile_" << getpid();
setenv("OMPI_URI_FILE",urifile.str().c_str(),1);
if( GetenvThreadSafe("OMPI_URI_FILE") != NULL ){
// get the pid of all ompi-server
// launch a new ompi-server
std::string command;
command = "ompi-server -r ";
- command += GetenvThreadSafe("OMPI_URI_FILE");
+ command += GetenvThreadSafeAsString("OMPI_URI_FILE");
int status=SystemThreadSafe(command.c_str());
if(status!=0)
throw SALOME_Exception("Error when launching ompi-server");
}
//=============================================================================
-/*!
+/*!
* destructor
*/
//=============================================================================
MESSAGE("ShutdownContainers: " << (*iter));
cont->Shutdown();
}
- else
+ else
MESSAGE("ShutdownContainers: no container ref for " << (*iter));
}
catch(CORBA::SystemException& e)
MESSAGE("[GiveContainer] - length of possible resources " << possibleResources.size());
std::vector<std::string> local_resources;
- // Step 3: if mode is "get" keep only machines with existing containers
+ // Step 3: if mode is "get" keep only machines with existing containers
if(mode == "get")
{
for(unsigned int i=0; i < possibleResources.size(); i++)
else
{
ASSERT(GetenvThreadSafe("APPLI"));
- command += GetenvThreadSafe("APPLI");
+ command += GetenvThreadSafeAsString("APPLI");
}
command += "/runRemote.sh ";
ASSERT(GetenvThreadSafe("NSHOST"));
- command += GetenvThreadSafe("NSHOST"); // hostname of CORBA name server
+ command += GetenvThreadSafeAsString("NSHOST"); // hostname of CORBA name server
command += " ";
ASSERT(GetenvThreadSafe("NSPORT"));
- command += GetenvThreadSafe("NSPORT"); // port of CORBA name server
+ command += GetenvThreadSafeAsString("NSPORT"); // port of CORBA name server
command += " \"ls /tmp >/dev/null 2>&1\"";
// Launch remote command
//redirect stdout and stderr in a file
#ifdef WIN32
- logFilename=GetenvThreadSafe("TEMP");
+ logFilename=GetenvThreadSafeAsString("TEMP");
logFilename += "\\";
- user = GetenvThreadSafe( "USERNAME" );
+ user = GetenvThreadSafeAsString( "USERNAME" );
#else
- user = GetenvThreadSafe( "USER" );
+ user = GetenvThreadSafeAsString( "USER" );
+ if (user.empty())
+ user = GetenvThreadSafeAsString( "LOGNAME" );
logFilename="/tmp";
char* val = GetenvThreadSafe("SALOME_TMP_DIR");
if(val)
//=============================================================================
/*!
* This is no longer valid (C++ container are also python containers)
- */
+ */
//=============================================================================
bool isPythonContainer(const char* ContainerName)
{
* use to launch SALOME and servers in $APPLI: runAppli.sh, runRemote.sh)
* - where workingdir is the requested working directory for the container.
* If WORKINGDIR (and workingdir) is not present the working dir will be $HOME
- */
+ */
//=============================================================================
std::string
else
{
ASSERT(GetenvThreadSafe("APPLI"));
- command += GetenvThreadSafe("APPLI"); // path relative to user@machine $HOME
+ command += GetenvThreadSafeAsString("APPLI"); // path relative to user@machine $HOME
}
command += "/runRemote.sh ";
ASSERT(GetenvThreadSafe("NSHOST"));
- command += GetenvThreadSafe("NSHOST"); // hostname of CORBA name server
+ command += GetenvThreadSafeAsString("NSHOST"); // hostname of CORBA name server
command += " ";
ASSERT(GetenvThreadSafe("NSPORT"));
- command += GetenvThreadSafe("NSPORT"); // port of CORBA name server
+ command += GetenvThreadSafeAsString("NSPORT"); // port of CORBA name server
std::string wdir = params.workingdir.in();
if(wdir != "")
if(wdir == "$TEMPDIR")
wdir="\\$TEMPDIR";
command += wdir; // requested working directory
- command += "'";
+ command += "'";
}
if(params.isMPI)
command += "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace";
else{
command += "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace -ompi-server file:";
- command += GetenvThreadSafe("OMPI_URI_FILE");
+ command += GetenvThreadSafeAsString("OMPI_URI_FILE");
}
#elif defined(MPICH)
command += "-nameserver " + Kernel_Utils::GetHostname();
-#endif
+#endif
command += " SALOME_MPIContainer ";
}
else
//=============================================================================
/*!
* builds the command to be launched.
- */
+ */
//=============================================================================
std::string SALOME_ContainerManager::BuildCommandToLaunchLocalContainer(const Engines::ContainerParameters& params, const std::string& machinesFile, const std::string& container_exe, std::string& tmpFileName) const
{
else
{
o << "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace -ompi-server file:";
- o << GetenvThreadSafe("OMPI_URI_FILE");
+ o << GetenvThreadSafeAsString("OMPI_URI_FILE");
}
#elif defined(MPICH)
o << "-nameserver " + Kernel_Utils::GetHostname();
/*!
* removes the generated temporary file in case of a remote launch.
* This method is thread safe
- */
+ */
//=============================================================================
void SALOME_ContainerManager::RmTmpFile(std::string& tmpFileName)
#ifdef WIN32
std::string command = "del /F ";
#else
- std::string command = "rm ";
+ std::string command = "rm ";
#endif
if ( lenght > 4 )
command += tmpFileName.substr(0, lenght - 3 );
//=============================================================================
/*!
* add to command all options relative to naming service.
- */
+ */
//=============================================================================
void SALOME_ContainerManager::AddOmninamesParams(std::string& command) const
//=============================================================================
/*!
* add to command all options relative to naming service.
- */
+ */
//=============================================================================
void SALOME_ContainerManager::AddOmninamesParams(std::ostream& fileStream) const
//=============================================================================
/*!
* add to command all options relative to naming service.
- */
+ */
//=============================================================================
void SALOME_ContainerManager::AddOmninamesParams(std::ostream& fileStream, SALOME_NamingService *ns)
int count(TIME_OUT_TO_LAUNCH_CONT);
if (GetenvThreadSafe("TIMEOUT_TO_LAUNCH_CONTAINER") != 0)
{
- std::string new_count_str(GetenvThreadSafe("TIMEOUT_TO_LAUNCH_CONTAINER"));
+ std::string new_count_str(GetenvThreadSafeAsString("TIMEOUT_TO_LAUNCH_CONTAINER"));
int new_count;
std::istringstream ss(new_count_str);
if (!(ss >> new_count))
//=============================================================================
/*!
* generate a file name in /tmp directory
- */
+ */
//=============================================================================
std::string SALOME_ContainerManager::BuildTemporaryFileName()
//=============================================================================
/*!
* Builds in a temporary file the script to be launched.
- *
+ *
* Used if SALOME Application ($APPLI) is not defined.
* The command is build with data from CatalogResources, in which every path
* used on remote computer must be defined.
- */
+ */
//=============================================================================
std::string SALOME_ContainerManager::BuildTempFileToLaunchRemoteContainer (const std::string& resource_name, const Engines::ContainerParameters& params, std::string& tmpFileName) const
tempOutputFile << "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace";
else{
tempOutputFile << "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace -ompi-server file:";
- tempOutputFile << GetenvThreadSafe("OMPI_URI_FILE");
+ tempOutputFile << GetenvThreadSafeAsString("OMPI_URI_FILE");
}
#elif defined(MPICH)
tempOutputFile << "-nameserver " + Kernel_Utils::GetHostname();
#endif
}
- tempOutputFile << GetenvThreadSafe("KERNEL_ROOT_DIR") << "/bin/salome/";
+ tempOutputFile << GetenvThreadSafeAsString("KERNEL_ROOT_DIR") << "/bin/salome/";
if (params.isMPI)
{
throw SALOME_Exception("Unknown protocol");
if(status)
- throw SALOME_Exception("Error of connection on remote host");
+ throw SALOME_Exception("Error of connection on remote host");
command += resInfo.HostName;
command += " ";
else
{
ASSERT(GetenvThreadSafe("APPLI"));
- command += GetenvThreadSafe("APPLI"); // path relative to user@machine $HOME
+ command += GetenvThreadSafeAsString("APPLI"); // path relative to user@machine $HOME
}
command += "/runRemote.sh ";
ASSERT(GetenvThreadSafe("NSHOST"));
- command += GetenvThreadSafe("NSHOST"); // hostname of CORBA name server
+ command += GetenvThreadSafeAsString("NSHOST"); // hostname of CORBA name server
command += " ";
ASSERT(GetenvThreadSafe("NSPORT"));
- command += GetenvThreadSafe("NSPORT"); // port of CORBA name server
+ command += GetenvThreadSafeAsString("NSPORT"); // port of CORBA name server
command += " mpirun -np 1 hostname -s > " + tmpFile;
}
std::string SALOME_ContainerManager::machinesFile(const int nbproc)
{
std::string tmp;
- std::string nodesFile = GetenvThreadSafe("LIBBATCH_NODEFILE");
+ std::string nodesFile = GetenvThreadSafeAsString("LIBBATCH_NODEFILE");
std::string machinesFile = Kernel_Utils::GetTmpFileName();
std::ifstream fpi(nodesFile.c_str(),std::ios::in);
std::ofstream fpo(machinesFile.c_str(),std::ios::out);
return command.str();
}
-bool
+bool
SALOME_ContainerManager::checkPaCOParameters(Engines::ContainerParameters & params, std::string resource_selected)
{
bool result = true;
-
+
// Step 1 : check ContainerParameters
// Check container_name, has to be defined
if (std::string(params.container_name.in()) == "")
return result;
}
+/*
+ * :WARNING: Do not directly convert returned value to std::string
+ * This function may return NULL if env variable is not defined.
+ * And std::string(NULL) causes undefined behavior.
+ * Use GetenvThreadSafeAsString to properly get a std::string.
+*/
char *SALOME_ContainerManager::GetenvThreadSafe(const char *name)
{// getenv is not thread safe. See man 7 pthread.
Utils_Locker lock (&_getenvMutex);
return getenv(name);
}
+/*
+ * Return env variable as a std::string.
+ * Return empty string if env variable is not set.
+ */
+std::string SALOME_ContainerManager::GetenvThreadSafeAsString(const char *name)
+{
+ char* var = GetenvThreadSafe(name);
+ return var ? std::string(var) : std::string();
+}
+
int SALOME_ContainerManager::SystemThreadSafe(const char *command)
{
Utils_Locker lock (&_systemMutex);
// Step 3 : starting parallel container proxy
std::string command_proxy("");
std::string proxy_machine;
- try
+ try
{
command_proxy = BuildCommandToLaunchPaCOProxyContainer(params, machine_file_name, proxy_machine);
}
// Step 4 : starting parallel container nodes
std::string command_nodes("");
SALOME_ContainerManager::actual_launch_machine_t nodes_machines;
- try
+ try
{
command_nodes = BuildCommandToLaunchPaCONodeContainer(params, machine_file_name, nodes_machines, proxy_machine);
}
{
INFOS("[StarPaCOPPContainer] LaunchPaCONodeContainer failed !");
// Il faut tuer le proxy
- try
+ try
{
Engines::Container_var proxy = Engines::Container::_narrow(container_proxy);
proxy->Shutdown();
}
// Step 4 : connecting nodes and the proxy to actually create a parallel container
- for (int i = 0; i < params.nb_proc; i++)
+ for (int i = 0; i < params.nb_proc; i++)
{
std::ostringstream tmp;
tmp << i;
std::string theNodeMachine(nodes_machines[i]);
std::string containerNameInNS = _NS->BuildContainerNameForNS(container_node_name.c_str(), theNodeMachine.c_str());
obj = _NS->Resolve(containerNameInNS.c_str());
- if (CORBA::is_nil(obj))
+ if (CORBA::is_nil(obj))
{
INFOS("[StarPaCOPPContainer] CONNECTION FAILED From Naming Service !");
INFOS("[StarPaCOPPContainer] Container name is " << containerNameInNS);
}
// Step 5 : starting parallel container
- try
+ try
{
MESSAGE ("[StarPaCOPPContainer] Starting parallel object");
container_proxy->start();
}
catch(std::exception& exc)
{
- INFOS("Caught std::exception - "<<exc.what());
+ INFOS("Caught std::exception - "<<exc.what());
}
catch(...)
{
return ret;
}
-std::string
+std::string
SALOME_ContainerManager::BuildCommandToLaunchPaCOProxyContainer(const Engines::ContainerParameters& params,
std::string machine_file_name,
std::string & proxy_hostname)
MESSAGE("[BuildCommandToLaunchPaCOProxyContainer] remote machine case detected !");
remote_execution = true;
}
-
+
// Log environnement
std::string log_type("");
char * get_val = GetenvThreadSafe("PARALLEL_LOG");
command << " " << hostname;
command << " " << resource_definition.AppliPath;
command << "/runRemote.sh ";
- command << GetenvThreadSafe("NSHOST") << " "; // hostname of CORBA name server
- command << GetenvThreadSafe("NSPORT") << " "; // port of CORBA name server
+ command << GetenvThreadSafeAsString("NSHOST") << " "; // hostname of CORBA name server
+ command << GetenvThreadSafeAsString("NSPORT") << " "; // port of CORBA name server
}
command << exe_name;
return command.str();
}
-std::string
+std::string
SALOME_ContainerManager::BuildCommandToLaunchPaCONodeContainer(const Engines::ContainerParameters& params,
const std::string & machine_file_name,
SALOME_ContainerManager::actual_launch_machine_t & vect_machine,
command_node_stream << " " << hostname;
command_node_stream << " " << resource_definition.AppliPath;
command_node_stream << "/runRemote.sh ";
- command_node_stream << GetenvThreadSafe("NSHOST") << " "; // hostname of CORBA name server
- command_node_stream << GetenvThreadSafe("NSPORT") << " "; // port of CORBA name server
+ command_node_stream << GetenvThreadSafeAsString("NSHOST") << " "; // hostname of CORBA name server
+ command_node_stream << GetenvThreadSafeAsString("NSPORT") << " "; // port of CORBA name server
}
command_node_stream << exe_name;
if (resource_definition.Protocol == rsh)
command_remote_stream << "rcp ";
- else
+ else
command_remote_stream << "scp ";
command_remote_stream << machine_file_name << " ";
command_remote_stream << resource_definition.UserName << "@";
command_nodes << " " << hostname;
command_nodes << " " << resource_definition.AppliPath;
command_nodes << "/runRemote.sh ";
- command_nodes << GetenvThreadSafe("NSHOST") << " "; // hostname of CORBA name server
- command_nodes << GetenvThreadSafe("NSPORT") << " "; // port of CORBA name server
+ command_nodes << GetenvThreadSafeAsString("NSHOST") << " "; // hostname of CORBA name server
+ command_nodes << GetenvThreadSafeAsString("NSPORT") << " "; // port of CORBA name server
}
if (resource_definition.mpi == lam)
{
command_nodes << "mpiexec -ssi boot ";
- command_nodes << "-machinefile " << machine_file_name << " ";
+ command_nodes << "-machinefile " << machine_file_name << " ";
command_nodes << "-n " << params.nb_proc;
}
else
// We don't put hostname, because nodes are registered in the resource of the proxy
for (int i= 0; i < params.nb_proc; i++)
- vect_machine.push_back(proxy_hostname);
+ vect_machine.push_back(proxy_hostname);
command_nodes << command_end;
}
const std::string & exe_type,
const std::string & container_name,
const std::string & hostname,
- std::string & begin,
+ std::string & begin,
std::string & end)
{
if(log_type == "xterm")
{
// default into a file...
std::string logFilename = "/tmp/" + container_name + "_" + hostname + "_" + exe_type + "_";
- logFilename += std::string(GetenvThreadSafe("USER")) + ".log";
+ std::string user = GetenvThreadSafeAsString("USER");
+ if (user.empty())
+ user = GetenvThreadSafeAsString("LOGNAME");
+ logFilename += user + ".log";
end = " > " + logFilename + " 2>&1 & ";
}
}
-CORBA::Object_ptr
-SALOME_ContainerManager::LaunchPaCOProxyContainer(const std::string& command,
+CORBA::Object_ptr
+SALOME_ContainerManager::LaunchPaCOProxyContainer(const std::string& command,
const Engines::ContainerParameters& params,
const std::string & hostname)
{
int count(GetTimeOutToLoaunchServer());
CORBA::Object_var obj = CORBA::Object::_nil();
- std::string containerNameInNS = _NS->BuildContainerNameForNS(params.container_name.in(),
+ std::string containerNameInNS = _NS->BuildContainerNameForNS(params.container_name.in(),
hostname.c_str());
MESSAGE("[LaunchParallelContainer] Waiting for Parallel Container proxy : " << containerNameInNS);
- while (CORBA::is_nil(obj) && count)
+ while (CORBA::is_nil(obj) && count)
{
sleep(1);
count--;
obj = _NS->Resolve(containerNameInNS.c_str());
}
- try
+ try
{
container_proxy = PaCO::InterfaceManager::_narrow(obj);
}
*/
//=============================================================================
bool
-SALOME_ContainerManager::LaunchPaCONodeContainer(const std::string& command,
+SALOME_ContainerManager::LaunchPaCONodeContainer(const std::string& command,
const Engines::ContainerParameters& params,
const std::string& name,
SALOME_ContainerManager::actual_launch_machine_t & vect_machine)
INFOS("[LaunchPaCONodeContainer] Waiting for the nodes of the parallel container");
// We are waiting all the nodes
- for (int i = 0; i < params.nb_proc; i++)
+ for (int i = 0; i < params.nb_proc; i++)
{
CORBA::Object_var obj = CORBA::Object::_nil();
std::string theMachine(vect_machine[i]);
return ret;
}
-std::string
+std::string
SALOME_ContainerManager::BuildCommandToLaunchPaCOProxyContainer(const Engines::ContainerParameters& params,
std::string machine_file_name,
std::string & proxy_hostname)
return "";
}
-std::string
+std::string
SALOME_ContainerManager::BuildCommandToLaunchPaCONodeContainer(const Engines::ContainerParameters& params,
const std::string & machine_file_name,
- SALOME_ContainerManager::actual_launch_machine_t & vect_machine,
- const std::string & proxy_hostname)
+ SALOME_ContainerManager::actual_launch_machine_t & vect_machine,
+ const std::string & proxy_hostname)
{
return "";
}
-void
+void
SALOME_ContainerManager::LogConfiguration(const std::string & log_type,
const std::string & exe_type,
const std::string & container_name,
const std::string & hostname,
- std::string & begin,
+ std::string & begin,
std::string & end)
{
}
-CORBA::Object_ptr
-SALOME_ContainerManager::LaunchPaCOProxyContainer(const std::string& command,
+CORBA::Object_ptr
+SALOME_ContainerManager::LaunchPaCOProxyContainer(const std::string& command,
const Engines::ContainerParameters& params,
const std::string& hostname)
{
return ret;
}
-bool
-SALOME_ContainerManager::LaunchPaCONodeContainer(const std::string& command,
+bool
+SALOME_ContainerManager::LaunchPaCONodeContainer(const std::string& command,
const Engines::ContainerParameters& params,
const std::string& name,
SALOME_ContainerManager::actual_launch_machine_t & vect_machine)
#endif
}
-Launcher::Job::~Job()
+Launcher::Job::~Job()
{
LAUNCHER_MESSAGE("Deleting job number: " << _number);
#ifdef WITH_LIBBATCH
#ifdef WITH_LIBBATCH
if (_batch_job_id.getReference() != "undefined")
{
- try
+ try
{
_batch_job_id.deleteJob();
}
#ifdef WITH_LIBBATCH
if (_batch_job_id.getReference() != "undefined")
{
- try
+ try
{
_batch_job_id.deleteJob();
}
return _job_name;
}
-void
+void
Launcher::Job::setState(const std::string & state)
{
// State of a Job: CREATED, QUEUED, RUNNING, FINISHED, FAILED
_state = state;
}
-std::string
+std::string
Launcher::Job::getState() const
{
return _state;
return _assigned_hostnames;
}
-void
+void
Launcher::Job::setNumber(const int & number)
{
if (_number != -1)
return _number;
}
-void
+void
Launcher::Job::setResourceDefinition(const ParserResourcesType & resource_definition)
{
// Check machine_definition
if (resource_definition.UserName == "")
{
user_name = getenv("USER");
+ if (user_name == "")
+ user_name = getenv("LOGNAME");
if (user_name == "")
{
- std::string mess = "You must define a user name: into your resource description or with env variable USER";
+ std::string mess = "You must define a user name: into your resource description or with one of env variables USER/LOGNAME";
throw LauncherException(mess);
}
}
_resource_definition.UserName = user_name;
}
-ParserResourcesType
+ParserResourcesType
Launcher::Job::getResourceDefinition() const
{
return _resource_definition;
}
-void
+void
Launcher::Job::setJobFile(const std::string & job_file)
{
// Check job file
{
return _job_file;
}
-void
+void
Launcher::Job::setEnvFile(const std::string & env_file)
{
_env_file = env_file;
return _env_file;
}
-void
+void
Launcher::Job::setWorkDirectory(const std::string & work_directory)
{
_work_directory = work_directory;
}
-void
+void
Launcher::Job::setLocalDirectory(const std::string & local_directory)
{
_local_directory = local_directory;
}
-void
+void
Launcher::Job::setResultDirectory(const std::string & result_directory)
{
_result_directory = result_directory;
}
-void
+void
Launcher::Job::add_in_file(const std::string & file)
{
std::list<std::string>::iterator it = std::find(_in_files.begin(), _in_files.end(), file);
std::cerr << "Launcher::Job::add_in_file -- Warning file was already entered in in_files: " << file << std::endl;
}
-void
+void
Launcher::Job::add_out_file(const std::string & file)
{
std::list<std::string>::iterator it = std::find(_out_files.begin(), _out_files.end(), file);
std::cerr << "Launcher::Job::add_out_file -- Warning file was already entered in out_files: " << file << std::endl;
}
-void
+void
Launcher::Job::setMaximumDuration(const std::string & maximum_duration)
{
checkMaximumDuration(maximum_duration);
void
Launcher::Job::setLauncherFile(const std::string & launcher_file)
{
- _launcher_file = launcher_file;
+ _launcher_file = launcher_file;
}
void
Launcher::Job::setLauncherArgs(const std::string & launcher_args)
{
- _launcher_args = launcher_args;
+ _launcher_args = launcher_args;
}
-void
+void
Launcher::Job::setResourceRequiredParams(const resourceParams & resource_required_params)
{
checkResourceRequiredParams(resource_required_params);
_resource_required_params = resource_required_params;
}
-void
+void
Launcher::Job::setQueue(const std::string & queue)
{
_queue = queue;
_reference = reference;
}
-std::string
+std::string
Launcher::Job::getWorkDirectory() const
{
return _work_directory;
}
-std::string
+std::string
Launcher::Job::getLocalDirectory() const
{
return _local_directory;
return _result_directory;
}
-const std::list<std::string> &
+const std::list<std::string> &
Launcher::Job::get_in_files() const
{
return _in_files;
}
-const std::list<std::string> &
+const std::list<std::string> &
Launcher::Job::get_out_files() const
{
return _out_files;
}
-std::string
+std::string
Launcher::Job::getMaximumDuration() const
{
return _maximum_duration;
std::string
Launcher::Job::getLauncherFile() const
{
- return _launcher_file;
+ return _launcher_file;
}
std::string
Launcher::Job::getLauncherArgs() const
{
- return _launcher_args;
+ return _launcher_args;
}
-resourceParams
+resourceParams
Launcher::Job::getResourceRequiredParams() const
{
return _resource_required_params;
}
-std::string
+std::string
Launcher::Job::getQueue() const
{
return _queue;
return _reference;
}
-void
+void
Launcher::Job::checkMaximumDuration(const std::string & maximum_duration)
{
std::string result("");
std::string begin_edt_value = edt_value.substr(0, pos);
std::string mid_edt_value = edt_value.substr(pos, 1);
std::string end_edt_value = edt_value.substr(pos + 1, edt_value.npos);
-
+
long value;
std::istringstream iss(begin_edt_value);
if (!(iss >> value)) {
throw LauncherException(result);
}
-void
+void
Launcher::Job::checkResourceRequiredParams(const resourceParams & resource_required_params)
{
// nb_proc has be to > 0
}
}
-long
+long
Launcher::Job::convertMaximumDuration(const std::string & edt)
{
long hh, mm, ret;
return ret;
}
-std::string
+std::string
Launcher::Job::getLaunchDate() const
{
time_t rawtime;
time(&rawtime);
std::string launch_date = ctime(&rawtime);
int i = 0 ;
- for (;i < launch_date.size(); i++)
+ for (;i < launch_date.size(); i++)
if (launch_date[i] == '/' ||
launch_date[i] == '-' ||
launch_date[i] == ':' ||
- launch_date[i] == ' ')
+ launch_date[i] == ' ')
launch_date[i] = '_';
launch_date.erase(--launch_date.end()); // Last caracter is a \n
}
#ifdef WITH_LIBBATCH
-Batch::Job *
+Batch::Job *
Launcher::Job::getBatchJob()
{
update_job();
std::list<std::string> in_files(_in_files);
in_files.push_back(_job_file);
if (_env_file != "")
- in_files.push_back(_env_file);
+ in_files.push_back(_env_file);
for(std::list<std::string>::iterator it = in_files.begin(); it != in_files.end(); it++)
{
std::string file = *it;
#else
local_file = file;
#endif
-
+
// remote file -> get only file name from in_files
size_t found = file.find_last_of("/");
std::string remote_file = _work_directory + "/" + file.substr(found+1);
params[Batch::INFILE] += Batch::Couple(local_file, remote_file);
}
-
+
// _out_files
for(std::list<std::string>::iterator it = _out_files.begin(); it != _out_files.end(); it++)
{
return params;
}
-void
+void
Launcher::Job::setBatchManagerJobId(Batch::JobId batch_manager_job_id)
{
_batch_job_id = batch_manager_job_id;
}
-Batch::JobId
+Batch::JobId
Launcher::Job::getBatchManagerJobId() const
{
return _batch_job_id;
}
#endif
-void
+void
Launcher::Job::addSpecificParameter(const std::string & name,
const std::string & value)
{