Salome HOME
Moved username initialization to the constructor in BatchManager_eClients V1_2_0rc1 V5_1_5a1
authorbarate <barate>
Thu, 30 Sep 2010 14:27:44 +0000 (14:27 +0000)
committerbarate <barate>
Thu, 30 Sep 2010 14:27:44 +0000 (14:27 +0000)
24 files changed:
src/CCC/Batch_BatchManager_eCCC.cxx
src/CCC/Batch_BatchManager_eCCC.hxx
src/CCC/Batch_FactBatchManager_eCCC.cxx
src/CCC/Batch_FactBatchManager_eCCC.hxx
src/Core/Batch_BatchManager_eClient.cxx
src/Core/Batch_BatchManager_eClient.hxx
src/Core/Batch_FactBatchManager_eClient.hxx
src/LSF/Batch_BatchManager_eLSF.cxx
src/LSF/Batch_BatchManager_eLSF.hxx
src/LSF/Batch_FactBatchManager_eLSF.cxx
src/LSF/Batch_FactBatchManager_eLSF.hxx
src/PBS/Batch_BatchManager_ePBS.cxx
src/PBS/Batch_BatchManager_ePBS.hxx
src/PBS/Batch_FactBatchManager_ePBS.cxx
src/PBS/Batch_FactBatchManager_ePBS.hxx
src/PBS/Test/Test_ePBS.cxx
src/SGE/Batch_BatchManager_eSGE.cxx
src/SGE/Batch_BatchManager_eSGE.hxx
src/SGE/Batch_FactBatchManager_eSGE.cxx
src/SGE/Batch_FactBatchManager_eSGE.hxx
src/SSH/Batch_BatchManager_eSSH.cxx
src/SSH/Batch_BatchManager_eSSH.hxx
src/SSH/Batch_FactBatchManager_eSSH.cxx
src/SSH/Batch_FactBatchManager_eSSH.hxx

index fe2d9e399bf54c6590de4d2b533893fdcee847c7..cd2c5ec364e144faaaddc78809cc719ee1b86123 100644 (file)
@@ -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
index 9548267695aba8ed1db50d0f333bc5ebcce539f8..ccb0d6fd41d6f7c8ac7b248cec6fa2f46497deae 100644 (file)
@@ -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();
 
index 7590875f66cb97f9715ec6301ac4b95165059236..a3ca60803b0ac0bfdcc7bf9253122ef7acf7aa04 100644 (file)
@@ -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);
   }
 
 }
index bdca46fa26a67394b9236bc04941ea1d2a07d928..729b412c22efd3600791871e690488f145668ad5 100644 (file)
@@ -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;
index a7546459df9dba7441ebe0c46df9f6289560389a..6b998ed9a06d5149755c3e2d776b5de637c039e6 100644 (file)
@@ -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, "", "");
index 326c58b35d9648ea28127722867416e292aab0c4..d46319e24827e4ab28b7c6b80b25f5c28d74c7d4 100644 (file)
@@ -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);
index 0f0f3104befd793f056a87e77a3cd447f2c9a856..9713f68c4813fddaa856dd1debca8c976ade7dab 100644 (file)
@@ -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;
index 05eb0345f81a9400307801e57030ae1c5106158e..5b992b8b4bf5bebbe82440ca74d9f51cf7b382f2 100644 (file)
@@ -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
index 632a044139e859ee33d08ee02bef01741af8ad45..dafc6e4d2a7aa3df6a430e7548696c571b1405fc 100644 (file)
@@ -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();
 
index 03bf379fb3c22ee15ed372e3a32da7c208aee9db..ab3f1ef55ea13770d4c70ab6d1ece8af817fc1c2 100644 (file)
@@ -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);
   }
 
 }
index f6e37da55fed6b3f8c786433ae23af797d88976f..3fa21b23a1fefdd40cf643aeaebad9a9d1ee118d 100644 (file)
@@ -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;
index 2d0b43927478a4fe63ff0a9e3b33f5bf3fda891c..4d3b60550d8ccad70ccc1747e48dbeee364ffabf 100644 (file)
@@ -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
index 452d59f2123036f042758768e9a5235339936081..ae055a50247d920ca86fe697a0b2095681bd4f40 100644 (file)
@@ -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();
index 502c91bd812913142129167e0cdf95132493e848..a71271f8e7cacdbb4c3cf38146886aa622a8c64c 100644 (file)
@@ -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);
   }
 
 
index 065e0d1b97f6ad7a7508e16aa16dd2d459590992..315803d263d90beccad7cad5b198194db7929778 100644 (file)
@@ -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;
index c427f17c40adcbe1cc89980d3649b0ccb142b4db..1a3b92d2879323cc6ba63e27a209907bc5f1313a 100644 (file)
@@ -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);
index 32e2ecbd1958299db89c5de13035cd7324ae21aa..20d5c4b5baede809fbf9a9366e8b6758a1065125 100644 (file)
@@ -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
index 3743752b2c0fa2f1f9e7efbd17594f0b26d8b247..143e9c2af49000147d9bfc64fbbe43d94b626310 100644 (file)
@@ -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();
 
index 26222663d1439c72c1a927f9d84068c4addc5e70..b7f76475751c52ab5ef3de3b5204890b5a0b425a 100644 (file)
@@ -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);
   }
 
 
index b4041005f13877d22f907f57c7c7c9c1f550be32..4511263befb31e4fce8ba9cf22628ac537d2370b 100644 (file)
@@ -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;
index 1378202917d8af99eabc251888748c5b8d285aba..1d49e032b89407a19027180360bc6de3dfb4e4aa 100644 (file)
@@ -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)
   {
index adcb28c3d1b96f0d6f37b76b226df51290d2bd1c..8eb0743049c38ae31cc1ccb5a0b7d4bbdb4ebd42 100644 (file)
@@ -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();
 
index d2f58cf8d4a2ffc3d4f07079031a9e67d34f54c4..4a6ef35cb7588fd86ccc76b6cb5065f5ad733bde 100644 (file)
@@ -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);
 }
index cfcd2de8988166841fe2903471a871c88595ba74..ed750a68eef318e7eb2bb331b0245154243a81c9 100644 (file)
@@ -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