return ret;
}
+ void BatchManager::clearWorkingDir( const Job & job)
+ {
+ Parametre params = job.getParametre();
+
+ string wd = params[WORKDIR];
+ if(!wd.empty() && wd != "/")
+ {
+ int status = _protocol.removeDirectory(wd, _hostname, _username);
+ if (status)
+ LOG("removeDirectory command failed. Status is: " << status);
+ }
+ else
+ LOG("removeDirectory command failed. Invalid working directory: " << wd);
+ }
+
MpiImpl *BatchManager::FactoryMpiImpl(string mpiImpl)
{
if(mpiImpl == "lam")
bool importDumpStateFile( const Job & job, const std::string directory );
// copier le fichier work_file à partir du working_directory vers directory
virtual bool importWorkFile( const Job & job, const std::string& work_file, const std::string& directory );
+ virtual void clearWorkingDir( const Job & job );
// Get the underlying communication protocol
const CommunicationProtocol & getProtocol() const;
return string("rm ") + path;
}
+ string CommunicationProtocol::getRemoveDirectorySubCommand(const string & path) const
+ {
+ return string("rm -fR ") + path;
+ }
+
string CommunicationProtocol::getMakeDirectorySubCommand(const string & path) const
{
return string("mkdir -p ") + path;
return status;
}
+ int CommunicationProtocol::removeDirectory(const std::string & path,
+ const std::string & host,
+ const std::string & user) const
+ {
+ string command = getExecCommand(getRemoveDirectorySubCommand(path), host, user);
+ LOG(command);
+ int status = system(command.c_str());
+ return status;
+ }
+
int CommunicationProtocol::makeDirectory(const std::string & path,
const std::string & host,
const std::string & user) const
const std::string & host,
const std::string & user) const;
+ virtual int removeDirectory(const std::string & path,
+ const std::string & host,
+ const std::string & user) const;
+
virtual int makeDirectory(const std::string & path,
const std::string & host,
const std::string & user) const;
virtual std::string getRemoveSubCommand(const std::string & path) const;
+ virtual std::string getRemoveDirectorySubCommand(const std::string & path) const;
+
virtual std::string getMakeDirectorySubCommand(const std::string & path) const;
std::string commandStringFromArgs(const std::vector<std::string> & args) const;