/*! Time for the batch (has to be like this : hh:mm) - Could be empty, in
this case, default value of the selected resource will be used.
*/
- string maximum_during_time;
+ string maximum_duration;
// Memory is expressed in megabytes -> mem_mb
// Number of Processors -> nb_node
{
_number = -1;
_state = "CREATED";
+ _launch_date = getLaunchDate();
_work_directory = "";
_local_directory = "";
_result_directory = "";
- _maximum_during_time = "";
- _maximum_during_time_in_second = -1;
+ _maximum_duration = "";
+ _maximum_duration_in_second = -1;
_machine_required_params.hostname = "";
_machine_required_params.OS = "";
_machine_required_params.nb_node = -1;
}
void
-Launcher::Job::setMaximumDuringTime(const std::string & maximum_during_time)
+Launcher::Job::setMaximumDuration(const std::string & maximum_duration)
{
- checkMaximumDuringTime(maximum_during_time);
- _maximum_during_time_in_second = convertMaximumDuringTime(maximum_during_time);
- _maximum_during_time = maximum_during_time;
+ checkMaximumDuration(maximum_duration);
+ _maximum_duration_in_second = convertMaximumDuration(maximum_duration);
+ _maximum_duration = maximum_duration;
}
void
}
std::string
-Launcher::Job::getMaximumDuringTime()
+Launcher::Job::getMaximumDuration()
{
- return _maximum_during_time;
+ return _maximum_duration;
}
machineParams
}
void
-Launcher::Job::checkMaximumDuringTime(const std::string & maximum_during_time)
+Launcher::Job::checkMaximumDuration(const std::string & maximum_duration)
{
std::string result("");
- std::string edt_value = maximum_during_time;
+ std::string edt_value = maximum_duration;
if (edt_value != "") {
std::string begin_edt_value = edt_value.substr(0, 2);
std::string mid_edt_value = edt_value.substr(2, 1);
long value;
std::istringstream iss(begin_edt_value);
if (!(iss >> value)) {
- result = "[Launcher::Job::checkExpectedDuringTime] Error on definition ! : " + edt_value;
+ result = "[Launcher::Job::checkExpectedDuration] Error on definition ! : " + edt_value;
}
else if (value < 0) {
- result = "[Launcher::Job::checkExpectedDuringTime] Error on definition time is negative ! : " + value;
+ result = "[Launcher::Job::checkExpectedDuration] Error on definition time is negative ! : " + value;
}
std::istringstream iss_2(end_edt_value);
if (!(iss_2 >> value)) {
- result = "[Launcher::Job::checkExpectedDuringTime] Error on definition ! : " + edt_value;
+ result = "[Launcher::Job::checkExpectedDuration] Error on definition ! : " + edt_value;
}
else if (value < 0) {
- result = "[Launcher::Job::checkExpectedDuringTime] Error on definition time is negative ! : " + value;
+ result = "[Launcher::Job::checkExpectedDuration] Error on definition time is negative ! : " + value;
}
if (mid_edt_value != ":") {
- result = "[Launcher::Job::checkExpectedDuringTime] Error on definition ! :" + edt_value;
+ result = "[Launcher::Job::checkExpectedDuration] Error on definition ! :" + edt_value;
}
}
if (result != "")
}
long
-Launcher::Job::convertMaximumDuringTime(const std::string & edt)
+Launcher::Job::convertMaximumDuration(const std::string & edt)
{
long hh, mm, ret;
}
// Time
- if (_maximum_during_time_in_second != -1)
- params[MAXWALLTIME] = _maximum_during_time_in_second;
+ if (_maximum_duration_in_second != -1)
+ params[MAXWALLTIME] = _maximum_duration_in_second;
// Queue
if (_queue != "")
void setResultDirectory(const std::string & result_directory);
void add_in_file(const std::string & file);
void add_out_file(const std::string & file);
- void setMaximumDuringTime(const std::string & maximum_during_time);
+ void setMaximumDuration(const std::string & maximum_duration);
void setMachineRequiredParams(const machineParams & machine_required_params);
void setQueue(const std::string & queue);
std::string getResultDirectory();
const std::list<std::string> & get_in_files();
const std::list<std::string> & get_out_files();
- std::string getMaximumDuringTime();
+ std::string getMaximumDuration();
machineParams getMachineRequiredParams();
std::string getQueue();
std::string updateJobState();
// Checks
- void checkMaximumDuringTime(const std::string & maximum_during_time);
+ void checkMaximumDuration(const std::string & maximum_duration);
void checkMachineRequiredParams(const machineParams & machine_required_params);
// Helps
- long convertMaximumDuringTime(const std::string & maximum_during_time);
+ long convertMaximumDuration(const std::string & maximum_duration);
std::string getLaunchDate();
// Abstract class
int _number;
std::string _state;
+ std::string _launch_date;
ParserResourcesType _machine_definition;
std::string _result_directory;
std::list<std::string> _in_files;
std::list<std::string> _out_files;
- std::string _maximum_during_time;
- long _maximum_during_time_in_second;
+ std::string _maximum_duration;
+ long _maximum_duration_in_second;
machineParams _machine_required_params;
std::string _queue;
params[INFILE] += Batch::Couple(local_file, remote_file);
}
- // log
- std::string launch_date = getLaunchDate();
- std::string log_file = "command_" + launch_date + ".log";
- std::string log_local_file = _result_directory + "/" + log_file;
- std::string log_remote_file = _work_directory + "/" + log_file;
- params[OUTFILE] += Batch::Couple(log_local_file, log_remote_file);
-
- params[EXECUTABLE] = buildCommandScript(params, launch_date);
+ params[EXECUTABLE] = buildCommandScript(params, _launch_date);
_batch_job->setParametre(params);
#endif
}
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 << "source ./" << _env_file.substr(last+1) << std::endl;
}
- launch_script_stream << "./" << command_file_name << " > command_" << launch_date << ".log 2>&1" << std::endl;
+ launch_script_stream << "./" << command_file_name << " > " << work_directory <<"/logs/command_" << launch_date << ".log 2>&1" << std::endl;
// Return
launch_script_stream.flush();
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 = getLaunchDate();
- std::string launch_date_port_file = launch_date;
- std::string launch_script = "/tmp/runSalome_" + yacs_file_name + "_" + launch_date + ".sh";
+ 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);
std::string machine_protocol = "ssh";
if (_machine_definition.Protocol == rsh)
machine_protocol = "rsh";
- launch_script_stream << "CATALOG_FILE=" << work_directory << "/CatalogResources_" << launch_date << ".xml" << 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 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 << _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"
<< " 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 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
// Expected During Time
try
{
- std::string maximum_during_time = job_parameters.maximum_during_time.in();
- new_job->setMaximumDuringTime(maximum_during_time);
+ std::string maximum_duration = job_parameters.maximum_duration.in();
+ new_job->setMaximumDuration(maximum_duration);
}
catch(const LauncherException &ex){
INFOS(ex.msg.c_str());