From: barate Date: Thu, 30 Sep 2010 14:27:44 +0000 (+0000) Subject: Moved username initialization to the constructor in BatchManager_eClients X-Git-Tag: V1_2_0rc1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=98764c03af9ff358bea30df6ae0952e37d155e79;p=tools%2Flibbatch.git Moved username initialization to the constructor in BatchManager_eClients --- diff --git a/src/CCC/Batch_BatchManager_eCCC.cxx b/src/CCC/Batch_BatchManager_eCCC.cxx index fe2d9e3..cd2c5ec 100644 --- a/src/CCC/Batch_BatchManager_eCCC.cxx +++ b/src/CCC/Batch_BatchManager_eCCC.cxx @@ -55,8 +55,9 @@ using namespace std; namespace Batch { BatchManager_eCCC::BatchManager_eCCC(const FactBatchManager * parent, const char * host, + const char * username, CommunicationProtocolType protocolType, const char * mpiImpl) - : BatchManager_eClient(parent, host, protocolType, mpiImpl), + : BatchManager_eClient(parent, host, username, protocolType, mpiImpl), BatchManager(parent, host) { // Nothing to do diff --git a/src/CCC/Batch_BatchManager_eCCC.hxx b/src/CCC/Batch_BatchManager_eCCC.hxx index 9548267..ccb0d6f 100644 --- a/src/CCC/Batch_BatchManager_eCCC.hxx +++ b/src/CCC/Batch_BatchManager_eCCC.hxx @@ -45,6 +45,7 @@ namespace Batch { public: // Constructeur et destructeur BatchManager_eCCC(const FactBatchManager * parent, const char * host="localhost", + const char * username="", CommunicationProtocolType protocolType = SSH, const char * mpiImpl="nompi"); // connexion a la machine host virtual ~BatchManager_eCCC(); diff --git a/src/CCC/Batch_FactBatchManager_eCCC.cxx b/src/CCC/Batch_FactBatchManager_eCCC.cxx index 7590875..a3ca608 100644 --- a/src/CCC/Batch_FactBatchManager_eCCC.cxx +++ b/src/CCC/Batch_FactBatchManager_eCCC.cxx @@ -55,12 +55,13 @@ namespace Batch { } BatchManager_eClient * FactBatchManager_eCCC::operator() (const char * hostname, + const char * username, CommunicationProtocolType protocolType, const char * mpiImpl, int nb_proc_per_node) const { // MESSAGE("Building new BatchManager_CCC on host '" << hostname << "'"); - return new BatchManager_eCCC(this, hostname, protocolType, mpiImpl); + return new BatchManager_eCCC(this, hostname, username, protocolType, mpiImpl); } } diff --git a/src/CCC/Batch_FactBatchManager_eCCC.hxx b/src/CCC/Batch_FactBatchManager_eCCC.hxx index bdca46f..729b412 100644 --- a/src/CCC/Batch_FactBatchManager_eCCC.hxx +++ b/src/CCC/Batch_FactBatchManager_eCCC.hxx @@ -46,6 +46,7 @@ namespace Batch { virtual BatchManager * operator() (const char * hostname) const; virtual BatchManager_eClient * operator() (const char * hostname, + const char * username, CommunicationProtocolType protocolType, const char * mpiImpl, int nb_proc_per_node = 1) const; diff --git a/src/Core/Batch_BatchManager_eClient.cxx b/src/Core/Batch_BatchManager_eClient.cxx index a754645..6b998ed 100644 --- a/src/Core/Batch_BatchManager_eClient.cxx +++ b/src/Core/Batch_BatchManager_eClient.cxx @@ -61,8 +61,10 @@ using namespace std; namespace Batch { BatchManager_eClient::BatchManager_eClient(const Batch::FactBatchManager * parent, const char* host, + const char * username, CommunicationProtocolType protocolType, const char* mpiImpl) - : BatchManager(parent, host), _protocol(CommunicationProtocol::getInstance(protocolType)), _username("") + : BatchManager(parent, host), _protocol(CommunicationProtocol::getInstance(protocolType)), + _username(username) { // instanciation of mpi implementation needed to launch executable in batch script _mpiImpl = FactoryMpiImpl(mpiImpl); @@ -146,7 +148,6 @@ namespace Batch { Parametre params = job.getParametre(); Versatile V = params[OUTFILE]; Versatile::iterator Vit; - _username = string(params[USER]); // Create local result directory int status = CommunicationProtocol::getInstance(SH).makeDirectory(directory, "", ""); diff --git a/src/Core/Batch_BatchManager_eClient.hxx b/src/Core/Batch_BatchManager_eClient.hxx index 326c58b..d46319e 100644 --- a/src/Core/Batch_BatchManager_eClient.hxx +++ b/src/Core/Batch_BatchManager_eClient.hxx @@ -49,15 +49,14 @@ namespace Batch { public: // Constructeur et destructeur BatchManager_eClient(const Batch::FactBatchManager * parent, const char* host="localhost", + const char * username="", CommunicationProtocolType protocolType = SSH, const char* mpiImpl="mpich1"); virtual ~BatchManager_eClient(); void importOutputFiles( const Job & job, const std::string directory ); - void setUsername(const std::string & username) {_username = username;} - protected: const CommunicationProtocol & _protocol; // protocol to access _hostname - std::string _username; // username to access _hostname + const std::string _username; // username to access _hostname MpiImpl *_mpiImpl; // Mpi implementation to launch executable in batch script std::string generateTemporaryFileName(const std::string & prefix); diff --git a/src/Core/Batch_FactBatchManager_eClient.hxx b/src/Core/Batch_FactBatchManager_eClient.hxx index 0f0f310..9713f68 100644 --- a/src/Core/Batch_FactBatchManager_eClient.hxx +++ b/src/Core/Batch_FactBatchManager_eClient.hxx @@ -48,6 +48,7 @@ namespace Batch { virtual ~FactBatchManager_eClient(); virtual Batch::BatchManager_eClient * operator() (const char * hostname, + const char * username, CommunicationProtocolType protocolType, const char * mpi, int nb_proc_per_node = 1) const = 0; diff --git a/src/LSF/Batch_BatchManager_eLSF.cxx b/src/LSF/Batch_BatchManager_eLSF.cxx index 05eb034..5b992b8 100644 --- a/src/LSF/Batch_BatchManager_eLSF.cxx +++ b/src/LSF/Batch_BatchManager_eLSF.cxx @@ -55,8 +55,9 @@ using namespace std; namespace Batch { BatchManager_eLSF::BatchManager_eLSF(const FactBatchManager * parent, const char * host, + const char * username, CommunicationProtocolType protocolType, const char * mpiImpl) - : BatchManager_eClient(parent, host, protocolType, mpiImpl), + : BatchManager_eClient(parent, host, username, protocolType, mpiImpl), BatchManager(parent, host) { // Nothing to do diff --git a/src/LSF/Batch_BatchManager_eLSF.hxx b/src/LSF/Batch_BatchManager_eLSF.hxx index 632a044..dafc6e4 100644 --- a/src/LSF/Batch_BatchManager_eLSF.hxx +++ b/src/LSF/Batch_BatchManager_eLSF.hxx @@ -45,6 +45,7 @@ namespace Batch { public: // Constructeur et destructeur BatchManager_eLSF(const FactBatchManager * parent, const char * host="localhost", + const char * username="", CommunicationProtocolType protocolType = SSH, const char * mpiImpl="nompi"); // connexion a la machine host virtual ~BatchManager_eLSF(); diff --git a/src/LSF/Batch_FactBatchManager_eLSF.cxx b/src/LSF/Batch_FactBatchManager_eLSF.cxx index 03bf379..ab3f1ef 100644 --- a/src/LSF/Batch_FactBatchManager_eLSF.cxx +++ b/src/LSF/Batch_FactBatchManager_eLSF.cxx @@ -55,12 +55,13 @@ namespace Batch { } BatchManager_eClient * FactBatchManager_eLSF::operator() (const char * hostname, + const char * username, CommunicationProtocolType protocolType, const char * mpiImpl, int nb_proc_per_node) const { // MESSAGE("Building new BatchManager_LSF on host '" << hostname << "'"); - return new BatchManager_eLSF(this, hostname, protocolType, mpiImpl); + return new BatchManager_eLSF(this, hostname, username, protocolType, mpiImpl); } } diff --git a/src/LSF/Batch_FactBatchManager_eLSF.hxx b/src/LSF/Batch_FactBatchManager_eLSF.hxx index f6e37da..3fa21b2 100644 --- a/src/LSF/Batch_FactBatchManager_eLSF.hxx +++ b/src/LSF/Batch_FactBatchManager_eLSF.hxx @@ -46,6 +46,7 @@ namespace Batch { virtual BatchManager * operator() (const char * hostname) const; virtual BatchManager_eClient * operator() (const char * hostname, + const char * username, CommunicationProtocolType protocolType, const char * mpiImpl, int nb_proc_per_node = 1) const; diff --git a/src/PBS/Batch_BatchManager_ePBS.cxx b/src/PBS/Batch_BatchManager_ePBS.cxx index 2d0b439..4d3b605 100644 --- a/src/PBS/Batch_BatchManager_ePBS.cxx +++ b/src/PBS/Batch_BatchManager_ePBS.cxx @@ -55,9 +55,10 @@ using namespace std; namespace Batch { BatchManager_ePBS::BatchManager_ePBS(const FactBatchManager * parent, const char * host, + const char * username, CommunicationProtocolType protocolType, const char * mpiImpl, int nb_proc_per_node) - : BatchManager_eClient(parent, host, protocolType, mpiImpl), + : BatchManager_eClient(parent, host, username, protocolType, mpiImpl), BatchManager(parent, host) { // Nothing to do diff --git a/src/PBS/Batch_BatchManager_ePBS.hxx b/src/PBS/Batch_BatchManager_ePBS.hxx index 452d59f..ae055a5 100644 --- a/src/PBS/Batch_BatchManager_ePBS.hxx +++ b/src/PBS/Batch_BatchManager_ePBS.hxx @@ -45,6 +45,7 @@ namespace Batch { public: // Constructeur et destructeur BatchManager_ePBS(const FactBatchManager * parent, const char * host="localhost", + const char * username="", CommunicationProtocolType protocolType = SSH, const char * mpiImpl="nompi", int nb_proc_per_node=1); // connexion a la machine host virtual ~BatchManager_ePBS(); diff --git a/src/PBS/Batch_FactBatchManager_ePBS.cxx b/src/PBS/Batch_FactBatchManager_ePBS.cxx index 502c91b..a71271f 100644 --- a/src/PBS/Batch_FactBatchManager_ePBS.cxx +++ b/src/PBS/Batch_FactBatchManager_ePBS.cxx @@ -57,12 +57,13 @@ namespace Batch { } BatchManager_eClient * FactBatchManager_ePBS::operator() (const char * hostname, + const char * username, CommunicationProtocolType protocolType, const char * mpiImpl, int nb_proc_per_node) const { // MESSAGE("Building new BatchManager_PBS on host '" << hostname << "'"); - return new BatchManager_ePBS(this, hostname, protocolType, mpiImpl, nb_proc_per_node); + return new BatchManager_ePBS(this, hostname, username, protocolType, mpiImpl, nb_proc_per_node); } diff --git a/src/PBS/Batch_FactBatchManager_ePBS.hxx b/src/PBS/Batch_FactBatchManager_ePBS.hxx index 065e0d1..315803d 100644 --- a/src/PBS/Batch_FactBatchManager_ePBS.hxx +++ b/src/PBS/Batch_FactBatchManager_ePBS.hxx @@ -51,6 +51,7 @@ namespace Batch { virtual BatchManager * operator() (const char * hostname) const; virtual BatchManager_eClient * operator() (const char * hostname, + const char * username, CommunicationProtocolType protocolType, const char * mpiImpl, int nb_proc_per_node = 1) const; diff --git a/src/PBS/Test/Test_ePBS.cxx b/src/PBS/Test/Test_ePBS.cxx index c427f17..1a3b92d 100644 --- a/src/PBS/Test/Test_ePBS.cxx +++ b/src/PBS/Test/Test_ePBS.cxx @@ -96,7 +96,6 @@ int main(int argc, char** argv) p[INFILE] += Couple("setb.sh", "tmp/Batch/setb.sh"); p[OUTFILE] = Couple("result.txt", "tmp/Batch/result.txt"); p[TMPDIR] = "tmp/Batch/"; - p[USER] = user; p[NBPROC] = 1; p[MAXWALLTIME] = 1; p[MAXRAMSIZE] = 1; @@ -114,7 +113,7 @@ int main(int argc, char** argv) // Create a BatchManager of type ePBS on localhost FactBatchManager_eClient * fbm = (FactBatchManager_eClient *)(c("ePBS")); - BatchManager_eClient * bm = (*fbm)(host.c_str(), protocol, "lam"); + BatchManager_eClient * bm = (*fbm)(host.c_str(), user.c_str(), protocol, "lam"); // Submit the job to the BatchManager JobId jobid = bm->submitJob(job); diff --git a/src/SGE/Batch_BatchManager_eSGE.cxx b/src/SGE/Batch_BatchManager_eSGE.cxx index 32e2ecb..20d5c4b 100644 --- a/src/SGE/Batch_BatchManager_eSGE.cxx +++ b/src/SGE/Batch_BatchManager_eSGE.cxx @@ -54,8 +54,9 @@ using namespace std; namespace Batch { BatchManager_eSGE::BatchManager_eSGE(const FactBatchManager * parent, const char * host, + const char * username, CommunicationProtocolType protocolType, const char * mpiImpl) - : BatchManager_eClient(parent, host, protocolType, mpiImpl), + : BatchManager_eClient(parent, host, username, protocolType, mpiImpl), BatchManager(parent, host) { // Nothing to do diff --git a/src/SGE/Batch_BatchManager_eSGE.hxx b/src/SGE/Batch_BatchManager_eSGE.hxx index 3743752..143e9c2 100644 --- a/src/SGE/Batch_BatchManager_eSGE.hxx +++ b/src/SGE/Batch_BatchManager_eSGE.hxx @@ -45,6 +45,7 @@ namespace Batch { public: // Constructeur et destructeur BatchManager_eSGE(const FactBatchManager * parent, const char * host="localhost", + const char * username="", CommunicationProtocolType protocolType = SSH, const char * mpiImpl="nompi"); // connexion a la machine host virtual ~BatchManager_eSGE(); diff --git a/src/SGE/Batch_FactBatchManager_eSGE.cxx b/src/SGE/Batch_FactBatchManager_eSGE.cxx index 2622266..b7f7647 100644 --- a/src/SGE/Batch_FactBatchManager_eSGE.cxx +++ b/src/SGE/Batch_FactBatchManager_eSGE.cxx @@ -55,12 +55,13 @@ namespace Batch { } BatchManager_eClient * FactBatchManager_eSGE::operator() (const char * hostname, + const char * username, CommunicationProtocolType protocolType, const char * mpiImpl, int nb_proc_per_node) const { // MESSAGE("Building new BatchManager_SGE on host '" << hostname << "'"); - return new BatchManager_eSGE(this, hostname, protocolType, mpiImpl); + return new BatchManager_eSGE(this, hostname, username, protocolType, mpiImpl); } diff --git a/src/SGE/Batch_FactBatchManager_eSGE.hxx b/src/SGE/Batch_FactBatchManager_eSGE.hxx index b404100..4511263 100644 --- a/src/SGE/Batch_FactBatchManager_eSGE.hxx +++ b/src/SGE/Batch_FactBatchManager_eSGE.hxx @@ -47,6 +47,7 @@ namespace Batch { virtual BatchManager * operator() (const char * hostname) const; virtual BatchManager_eClient * operator() (const char * hostname, + const char * username, CommunicationProtocolType protocolType, const char * mpiImpl, int nb_proc_per_node = 1) const; diff --git a/src/SSH/Batch_BatchManager_eSSH.cxx b/src/SSH/Batch_BatchManager_eSSH.cxx index 1378202..1d49e03 100644 --- a/src/SSH/Batch_BatchManager_eSSH.cxx +++ b/src/SSH/Batch_BatchManager_eSSH.cxx @@ -49,8 +49,9 @@ using namespace std; namespace Batch { BatchManager_eSSH::BatchManager_eSSH(const FactBatchManager * parent, const char * host, + const char * username, CommunicationProtocolType protocolType, const char * mpiImpl) - : BatchManager_eClient(parent, host, protocolType, mpiImpl), + : BatchManager_eClient(parent, host, username, protocolType, mpiImpl), BatchManager_Local(parent, host, protocolType), BatchManager(parent, host) { diff --git a/src/SSH/Batch_BatchManager_eSSH.hxx b/src/SSH/Batch_BatchManager_eSSH.hxx index adcb28c..8eb0743 100644 --- a/src/SSH/Batch_BatchManager_eSSH.hxx +++ b/src/SSH/Batch_BatchManager_eSSH.hxx @@ -45,6 +45,7 @@ namespace Batch { public: // Constructeur et destructeur BatchManager_eSSH(const FactBatchManager * parent, const char * host="localhost", + const char * username="", CommunicationProtocolType protocolType = SSH, const char * mpiImpl="nompi"); // connexion a la machine host virtual ~BatchManager_eSSH(); diff --git a/src/SSH/Batch_FactBatchManager_eSSH.cxx b/src/SSH/Batch_FactBatchManager_eSSH.cxx index d2f58cf..4a6ef35 100644 --- a/src/SSH/Batch_FactBatchManager_eSSH.cxx +++ b/src/SSH/Batch_FactBatchManager_eSSH.cxx @@ -45,6 +45,7 @@ Batch::FactBatchManager_eSSH::operator() (const char * hostname) const Batch::BatchManager_eClient * Batch::FactBatchManager_eSSH::operator() (const char * hostname, + const char * username, CommunicationProtocolType protocolType, const char * mpiImpl, int nb_proc_per_node) const @@ -52,5 +53,5 @@ Batch::FactBatchManager_eSSH::operator() (const char * hostname, //protocolType and mpiImpl are ignored. std::cerr << "[Batch::FactBatchManager_eSSH] creating new Batch::BatchManager_eSSH with hostname = " << hostname << std::endl; - return new Batch::BatchManager_eSSH(this, hostname); + return new Batch::BatchManager_eSSH(this, hostname, username); } diff --git a/src/SSH/Batch_FactBatchManager_eSSH.hxx b/src/SSH/Batch_FactBatchManager_eSSH.hxx index cfcd2de..ed750a6 100644 --- a/src/SSH/Batch_FactBatchManager_eSSH.hxx +++ b/src/SSH/Batch_FactBatchManager_eSSH.hxx @@ -48,6 +48,7 @@ namespace Batch { virtual BatchManager * operator() (const char * hostname) const; // From FactBacthManager virtual BatchManager_eClient * operator() (const char * hostname, + const char * username, CommunicationProtocolType protocolType, const char * mpiImpl, int nb_proc_per_node = 1) const; // From FactBatchManager_eClient