From: ribes Date: Fri, 23 Jul 2010 11:33:40 +0000 (+0000) Subject: - Add a new method for resuming jobs X-Git-Tag: V1_2_0rc1~8 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3eff45124825320bd1abf844f0601785d3b909c1;p=tools%2Flibbatch.git - Add a new method for resuming jobs - Add a new method in eClient for username (we need to modify all eClient to use param['USER']) --- diff --git a/src/CCC/Batch_BatchManager_eCCC.cxx b/src/CCC/Batch_BatchManager_eCCC.cxx index c476002..fe2d9e3 100644 --- a/src/CCC/Batch_BatchManager_eCCC.cxx +++ b/src/CCC/Batch_BatchManager_eCCC.cxx @@ -125,6 +125,13 @@ namespace Batch { return id; } + // Ce manager permet de faire de la reprise + const Batch::JobId + BatchManager_eCCC::addJob(const Batch::Job & job, const std::string reference) + { + return JobId(this, reference); + } + // Methode pour le controle des jobs : retire un job du gestionnaire void BatchManager_eCCC::deleteJob(const JobId & jobid) { diff --git a/src/CCC/Batch_BatchManager_eCCC.hxx b/src/CCC/Batch_BatchManager_eCCC.hxx index 5a149a5..9548267 100644 --- a/src/CCC/Batch_BatchManager_eCCC.hxx +++ b/src/CCC/Batch_BatchManager_eCCC.hxx @@ -65,6 +65,7 @@ namespace Batch { virtual void setParametre(const JobId & jobid, const Parametre & param) { return alterJob(jobid, param); } // modifie un job en file d'attente virtual void setEnvironnement(const JobId & jobid, const Environnement & env) { return alterJob(jobid, env); } // modifie un job en file d'attente + virtual const Batch::JobId addJob(const Batch::Job & job, const std::string reference); // ajoute un nouveau job sans le soumettre protected: void buildBatchScript(const Job & job); diff --git a/src/Core/Batch_BatchManager.hxx b/src/Core/Batch_BatchManager.hxx index d19a183..2974d81 100644 --- a/src/Core/Batch_BatchManager.hxx +++ b/src/Core/Batch_BatchManager.hxx @@ -69,6 +69,7 @@ namespace Batch { virtual void alterJob(const Batch::JobId & jobid, const Batch::Parametre & param) = 0; // modifie un job en file d'attente virtual void alterJob(const Batch::JobId & jobid, const Batch::Environnement & env) = 0; // modifie un job en file d'attente virtual Batch::JobInfo queryJob(const Batch::JobId & jobid) = 0; // renvoie l'etat du job + virtual const Batch::JobId addJob(const Batch::Job & job, const std::string reference) = 0; // ajoute un nouveau job sans le soumettre virtual std::string waitForJobEnd(const Batch::JobId & jobid, long timeout = -1, long initSleepTime = 1, long maxSleepTime = 600); diff --git a/src/Core/Batch_BatchManager_eClient.cxx b/src/Core/Batch_BatchManager_eClient.cxx index 83716f1..1a6a488 100644 --- a/src/Core/Batch_BatchManager_eClient.cxx +++ b/src/Core/Batch_BatchManager_eClient.cxx @@ -81,7 +81,6 @@ namespace Batch { Parametre params = job.getParametre(); Versatile V = params[INFILE]; Versatile::iterator Vit; - _username = string(params[USER]); status = _protocol.makeDirectory(string(params[TMPDIR]) + "/logs", _hostname, _username); if(status) { diff --git a/src/Core/Batch_BatchManager_eClient.hxx b/src/Core/Batch_BatchManager_eClient.hxx index 7641ec9..188a2df 100644 --- a/src/Core/Batch_BatchManager_eClient.hxx +++ b/src/Core/Batch_BatchManager_eClient.hxx @@ -53,6 +53,8 @@ namespace Batch { virtual ~BatchManager_eClient(); void importOutputFiles( const Job & job, const std::string directory ) throw(EmulationException); + void setUsername(const std::string & username) {_username = username;} + protected: const CommunicationProtocol & _protocol; // protocol to access _hostname std::string _username; // username to access _hostname diff --git a/src/Core/Batch_JobId.cxx b/src/Core/Batch_JobId.cxx index 453e47a..05ad4f9 100644 --- a/src/Core/Batch_JobId.cxx +++ b/src/Core/Batch_JobId.cxx @@ -76,6 +76,12 @@ namespace Batch { return _reference; } + // Permet de recharger un job depuis un fichier + void JobId::setReference(const std::string & new_reference) + { + _reference = new_reference; + } + // Methode pour le controle du job : retire le job du gestionnaire void JobId::deleteJob() const { diff --git a/src/Core/Batch_JobId.hxx b/src/Core/Batch_JobId.hxx index 2e0a0af..f0a446e 100644 --- a/src/Core/Batch_JobId.hxx +++ b/src/Core/Batch_JobId.hxx @@ -62,6 +62,9 @@ namespace Batch { // Accesseur pour la reference interne virtual std::string getReference() const; + // Permet de recharger un job depuis un fichier + virtual void setReference(const std::string & new_reference); + // Methodes pour le controle du job virtual void deleteJob() const; // retire un job du gestionnaire virtual void holdJob() const; // suspend un job en file d'attente diff --git a/src/LSF/Batch_BatchManager_LSF.cxx b/src/LSF/Batch_BatchManager_LSF.cxx index 0826151..5fe0649 100644 --- a/src/LSF/Batch_BatchManager_LSF.cxx +++ b/src/LSF/Batch_BatchManager_LSF.cxx @@ -82,6 +82,13 @@ namespace Batch { return id; } + // Ce manager permet de faire de la reprise + const Batch::JobId + BatchManager_LSF::addJob(const Batch::Job & job, const std::string reference) + { + return JobId(this, reference); + } + // Methode pour le controle des jobs : retire un job du gestionnaire void BatchManager_LSF::deleteJob(const JobId & jobid) { diff --git a/src/LSF/Batch_BatchManager_LSF.hxx b/src/LSF/Batch_BatchManager_LSF.hxx index 38c9e36..498ac7b 100644 --- a/src/LSF/Batch_BatchManager_LSF.hxx +++ b/src/LSF/Batch_BatchManager_LSF.hxx @@ -77,6 +77,7 @@ namespace Batch { virtual void setParametre(const JobId & jobid, const Parametre & param) { return alterJob(jobid, param); } // modifie un job en file d'attente virtual void setEnvironnement(const JobId & jobid, const Environnement & env) { return alterJob(jobid, env); } // modifie un job en file d'attente + virtual const Batch::JobId addJob(const Batch::Job & job, const std::string reference); // ajoute un nouveau job sans le soumettre protected: int _connect; // LSF connect id diff --git a/src/LSF/Batch_BatchManager_eLSF.cxx b/src/LSF/Batch_BatchManager_eLSF.cxx index f5fc22d..fc36f7f 100644 --- a/src/LSF/Batch_BatchManager_eLSF.cxx +++ b/src/LSF/Batch_BatchManager_eLSF.cxx @@ -125,6 +125,13 @@ namespace Batch { return id; } + // Ce manager permet de faire de la reprise + const Batch::JobId + BatchManager_eLSF::addJob(const Batch::Job & job, const std::string reference) + { + return JobId(this, reference); + } + // Methode pour le controle des jobs : retire un job du gestionnaire void BatchManager_eLSF::deleteJob(const JobId & jobid) { diff --git a/src/LSF/Batch_BatchManager_eLSF.hxx b/src/LSF/Batch_BatchManager_eLSF.hxx index a0cc9db..632a044 100644 --- a/src/LSF/Batch_BatchManager_eLSF.hxx +++ b/src/LSF/Batch_BatchManager_eLSF.hxx @@ -65,6 +65,7 @@ namespace Batch { virtual void setParametre(const JobId & jobid, const Parametre & param) { return alterJob(jobid, param); } // modifie un job en file d'attente virtual void setEnvironnement(const JobId & jobid, const Environnement & env) { return alterJob(jobid, env); } // modifie un job en file d'attente + virtual const Batch::JobId addJob(const Batch::Job & job, const std::string reference); // ajoute un nouveau job sans le soumettre protected: void buildBatchScript(const Job & job); diff --git a/src/Local/Batch_BatchManager_Local.cxx b/src/Local/Batch_BatchManager_Local.cxx index 4456fec..7e0c0b0 100644 --- a/src/Local/Batch_BatchManager_Local.cxx +++ b/src/Local/Batch_BatchManager_Local.cxx @@ -246,6 +246,14 @@ namespace Batch { } + // Ce manager ne peut pas reprendre un job + // On force donc l'état du job à erreur - pour cela on ne donne pas d'Id + // au JobId + const Batch::JobId + BatchManager_Local::addJob(const Batch::Job & job, const std::string reference) + { + return JobId(this, "undefined"); + } // Methode pour le controle des jobs : teste si un job est present en machine bool BatchManager_Local::isRunning(const JobId & jobid) diff --git a/src/Local/Batch_BatchManager_Local.hxx b/src/Local/Batch_BatchManager_Local.hxx index ec14db5..069d0a6 100644 --- a/src/Local/Batch_BatchManager_Local.hxx +++ b/src/Local/Batch_BatchManager_Local.hxx @@ -142,6 +142,7 @@ namespace Batch { virtual void setParametre(const JobId & jobid, const Parametre & param) { return alterJob(jobid, param); } // modifie un job en file d'attente virtual void setEnvironnement(const JobId & jobid, const Environnement & env) { return alterJob(jobid, env); } // modifie un job en file d'attente + virtual const Batch::JobId addJob(const Batch::Job & job, const std::string reference); // ajoute un nouveau job sans le soumettre protected: int _connect; // Local connect id diff --git a/src/PBS/Batch_BatchManager_PBS.cxx b/src/PBS/Batch_BatchManager_PBS.cxx index ba84a3a..05ce5b0 100644 --- a/src/PBS/Batch_BatchManager_PBS.cxx +++ b/src/PBS/Batch_BatchManager_PBS.cxx @@ -136,6 +136,13 @@ namespace Batch { return id; } + // Ce manager permet de faire de la reprise + const Batch::JobId + BatchManager_PBS::addJob(const Batch::Job & job, const std::string reference) + { + return JobId(this, reference); + } + // Methode pour le controle des jobs : retire un job du gestionnaire void BatchManager_PBS::deleteJob(const JobId & jobid) { diff --git a/src/PBS/Batch_BatchManager_PBS.hxx b/src/PBS/Batch_BatchManager_PBS.hxx index 62f19e5..581ed7c 100644 --- a/src/PBS/Batch_BatchManager_PBS.hxx +++ b/src/PBS/Batch_BatchManager_PBS.hxx @@ -78,6 +78,8 @@ namespace Batch { virtual void setParametre(const JobId & jobid, const Parametre & param) { return alterJob(jobid, param); } // modifie un job en file d'attente virtual void setEnvironnement(const JobId & jobid, const Environnement & env) { return alterJob(jobid, env); } // modifie un job en file d'attente + virtual const Batch::JobId addJob(const Batch::Job & job, const std::string reference); // ajoute un nouveau job sans le soumettre + protected: std::string getErrorMessage(const char * operation) const; diff --git a/src/PBS/Batch_BatchManager_ePBS.cxx b/src/PBS/Batch_BatchManager_ePBS.cxx index 7512544..2d0b439 100644 --- a/src/PBS/Batch_BatchManager_ePBS.cxx +++ b/src/PBS/Batch_BatchManager_ePBS.cxx @@ -121,6 +121,13 @@ namespace Batch { return id; } + // Ce manager permet de faire de la reprise + const Batch::JobId + BatchManager_ePBS::addJob(const Batch::Job & job, const std::string reference) + { + return JobId(this, reference); + } + // Methode pour le controle des jobs : retire un job du gestionnaire void BatchManager_ePBS::deleteJob(const JobId & jobid) { diff --git a/src/PBS/Batch_BatchManager_ePBS.hxx b/src/PBS/Batch_BatchManager_ePBS.hxx index 8ccc60c..452d59f 100644 --- a/src/PBS/Batch_BatchManager_ePBS.hxx +++ b/src/PBS/Batch_BatchManager_ePBS.hxx @@ -66,6 +66,7 @@ namespace Batch { virtual void setParametre(const JobId & jobid, const Parametre & param) { return alterJob(jobid, param); } // modifie un job en file d'attente virtual void setEnvironnement(const JobId & jobid, const Environnement & env) { return alterJob(jobid, env); } // modifie un job en file d'attente + virtual const Batch::JobId addJob(const Batch::Job & job, const std::string reference); // ajoute un nouveau job sans le soumettre protected: void buildBatchScript(const Job & job); diff --git a/src/SGE/Batch_BatchManager_eSGE.cxx b/src/SGE/Batch_BatchManager_eSGE.cxx index a7f9d3f..32e2ecb 100644 --- a/src/SGE/Batch_BatchManager_eSGE.cxx +++ b/src/SGE/Batch_BatchManager_eSGE.cxx @@ -120,6 +120,13 @@ namespace Batch { return id; } + // Ce manager permet de faire de la reprise + const Batch::JobId + BatchManager_eSGE::addJob(const Batch::Job & job, const std::string reference) + { + return JobId(this, reference); + } + // Methode pour le controle des jobs : retire un job du gestionnaire void BatchManager_eSGE::deleteJob(const JobId & jobid) { diff --git a/src/SGE/Batch_BatchManager_eSGE.hxx b/src/SGE/Batch_BatchManager_eSGE.hxx index 3d97404..3743752 100644 --- a/src/SGE/Batch_BatchManager_eSGE.hxx +++ b/src/SGE/Batch_BatchManager_eSGE.hxx @@ -65,6 +65,7 @@ namespace Batch { virtual void setParametre(const JobId & jobid, const Parametre & param) { return alterJob(jobid, param); } // modifie un job en file d'attente virtual void setEnvironnement(const JobId & jobid, const Environnement & env) { return alterJob(jobid, env); } // modifie un job en file d'attente + virtual const Batch::JobId addJob(const Batch::Job & job, const std::string reference); // ajoute un nouveau job sans le soumettre protected: void buildBatchScript(const Job & job);