case prun:
mpi = "prun";
break;
- case nompi:
- std::cerr << "No MPI detected - switch to single machine case" << std::endl;
- if (protocol == Batch::SSH)
- params.Batch = ssh_batch;
- else
- throw LauncherException("you must specified an mpi implementation for batch manager or a ssh computer");
- break;
default:
- throw LauncherException("unknown mpi implementation");
- break;
- }
+ mpi = "nompi";
+ }
+
#if defined(_DEBUG_) || defined(_DEBUG)
cerr << "Instanciation of batch manager" << endl;
#endif
}
return (*fact)(hostname.c_str(), protocol, mpi.c_str());
#else
-M@M@ throw LauncherException("Method Launcher_cpp::FactoryBatchManager is not available "
- "(libBatch was not present at compilation time)");
+ throw LauncherException("Method Launcher_cpp::FactoryBatchManager is not available "
+ "(libBatch was not present at compilation time)");
#endif
}
delete new_job;
throw ex;
}
+ catch(const Batch::EmulationException &ex)
+ {
+ LAUNCHER_INFOS("Error during creation of the batch manager of the resource, mess: " << ex.message);
+ delete new_job;
+ throw LauncherException(ex.message);
+ }
}
// Final step - add job to the jobs map
LAUNCHER_MESSAGE("State received is: " << par[STATE].str());
// Patch until new LIBBATCH version
- // eSSH Client
- if (par[STATE].str() == "Running")
+ // eSSH Client and ePBS Client
+ if (par[STATE].str() == "Running" or par[STATE].str() == "E" or par[STATE].str() == "R")
_state = "RUNNING";
else if (par[STATE].str() == "Stopped")
_state = "PAUSED";
- else if (par[STATE].str() == "Done")
+ else if (par[STATE].str() == "Done" or par[STATE].str() == "U")
_state = "FINISHED";
else if (par[STATE].str() == "Dead")
_state = "ERROR";
+ else if (par[STATE].str() == "Q")
+ _state = "QUEUED";
}
#endif
return _state;
#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);
+
+ // Copy env file
+ if (_env_file != "")
+ {
+ if (_env_file.substr(0, 1) == std::string("/"))
+ local_file = _env_file;
+ else
+ local_file = _local_directory + "/" + _env_file;
+ found = _env_file.find_last_of("/");
+ remote_file = _work_directory + "/" + _env_file.substr(found+1);
+ params[INFILE] += Batch::Couple(local_file, remote_file);
+ }
+
// log
std::string log_file = "command.log";
std::string log_local_file = _result_directory + "/" + log_file;
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);
time_t rawtime;
time(&rawtime);
launch_script_stream << "#! /bin/sh -f" << std::endl;
launch_script_stream << "cd " << work_directory << std::endl;
if (_env_file != "")
- launch_script_stream << "source " << _env_file << std::endl;
- launch_script_stream << _command << " > command.log 2>&1" << std::endl;
+ {
+ std::string::size_type last = _env_file.find_last_of("/");
+ launch_script_stream << "source " << _env_file.substr(last+1) << std::endl;
+ }
+ launch_script_stream << "./" << command_file_name << " > command.log 2>&1" << std::endl;
// Return
launch_script_stream.flush();
std::string remote_file = _work_directory + "/" + _yacs_file.substr(found+1);
params[INFILE] += Batch::Couple(local_file, remote_file);
- // logs
- // local file -> If result_directory is not defined, we use HOME environnement
- std::string log_directory = "logs";
- std::string log_local_file = _result_directory + "/" + log_directory;
- std::string log_remote_file = _work_directory + "/" + log_directory;
- params[OUTFILE] += Batch::Couple(log_local_file, log_remote_file);
-
params[EXECUTABLE] = buildSalomeCouplingScript(params);
// Add in files -> yacs_file and launch_script
// Begin of script
launch_script_stream << "#! /bin/sh -f" << std::endl;
launch_script_stream << "cd " << work_directory << std::endl;
- launch_script_stream << "mkdir logs" << std::endl;
launch_script_stream << "export SALOME_TMP_DIR=" << work_directory << "/logs" << std::endl;
// -- Generates Catalog Resources