Salome HOME
Removed old constants defined in global namespace. Warning: this change will break...
authorbarate <barate>
Wed, 27 Jan 2010 16:49:20 +0000 (16:49 +0000)
committerbarate <barate>
Wed, 27 Jan 2010 16:49:20 +0000 (16:49 +0000)
src/Core/Batch_Parametre.cxx
src/Core/Batch_Parametre.hxx
src/Local/Test/Test_Local_RSH.cxx
src/Local/Test/Test_Local_SH.cxx
src/Local/Test/Test_Local_SSH.cxx
src/PBS/Test/Test_PBS.cxx
src/PBS/Test/Test_ePBS.cxx
src/Python/Test/Test_Python_Local_SH.py

index 3031517e49b55b8dfb610d75f5d4a6526547a61d..b4775a0a0b587127f15f6f13caf24a237e6e20f6 100644 (file)
 
 using namespace std;
 
-// TODO: These definitions in global namespace are here only to avoid breaking Kernel compilation for now.
-// They must be removed as soon as possible.
-def_static_MapKey(ACCOUNT)
-def_static_MapKey(ARGUMENTS)
-def_static_MapKey(CHECKPOINT)
-def_static_MapKey(CKPTINTERVAL)
-def_static_MapKey(CREATIONTIME)
-def_static_MapKey(EGROUP)
-def_static_MapKey(ELIGIBLETIME)
-def_static_MapKey(ENDTIME)
-def_static_MapKey(EUSER)
-def_static_MapKey(EXECUTABLE)
-def_static_MapKey(EXECUTIONHOST)
-def_static_MapKey(EXITCODE)
-def_static_MapKey(HOLD)
-def_static_MapKey(ID)
-def_static_MapKey(INFILE)
-def_static_MapKey(MAIL)
-def_static_MapKey(MAXCPUTIME)
-def_static_MapKey(MAXDISKSIZE)
-def_static_MapKey(MAXRAMSIZE)
-def_static_MapKey(MAXWALLTIME)
-def_static_MapKey(MODIFICATIONTIME)
-def_static_MapKey(NAME)
-def_static_MapKey(NBPROC)
-def_static_MapKey(OUTFILE)
-def_static_MapKey(PID)
-def_static_MapKey(QUEUE)
-def_static_MapKey(QUEUEDTIME)
-def_static_MapKey(SERVER)
-def_static_MapKey(STARTTIME)
-def_static_MapKey(STATE)
-def_static_MapKey(TEXT)
-def_static_MapKey(TMPDIR)
-def_static_MapKey(USEDCPUTIME)
-def_static_MapKey(USEDDISKSIZE)
-def_static_MapKey(USEDRAMSIZE)
-def_static_MapKey(USEDWALLTIME)
-def_static_MapKey(USER)
-def_static_MapKey(WORKDIR)
-def_static_MapKey(HOMEDIR)
-
 namespace Batch {
 
   // Constructeur standard
index 4ba9f7b1848bb20a404000c58c57d49caec7ebbb..b3c11ad8adcef351f1233b50259d1ca77be9e9d2 100644 (file)
 
 #include "Batch_Defines.hxx"
 #include "Batch_Constants.hxx"
-#include "Batch_InvalidKeyException.hxx"
 #include "Batch_Versatile.hxx"
 
-// TODO: These declarations are here only to avoid breaking Kernel compilation for now.
-// They must be removed as soon as possible.
-#define def_extern_MapKey(mk) extern BATCH_EXPORT const std::string & mk;
-#define def_static_MapKey(mk) const std::string & mk = #mk;
-
 namespace Batch {
 
   class BATCH_EXPORT Parametre : public std::map< std::string, Versatile >
@@ -71,46 +65,4 @@ namespace Batch {
 
 }
 
-// TODO: These declarations in global namespace are here only to avoid breaking Kernel compilation for now.
-// They must be removed as soon as possible.
-def_extern_MapKey(ACCOUNT)
-def_extern_MapKey(ARGUMENTS)
-def_extern_MapKey(CHECKPOINT)
-def_extern_MapKey(CKPTINTERVAL)
-def_extern_MapKey(CREATIONTIME)
-def_extern_MapKey(EGROUP)
-def_extern_MapKey(ELIGIBLETIME)
-def_extern_MapKey(ENDTIME)
-def_extern_MapKey(EUSER)
-def_extern_MapKey(EXECUTABLE)
-def_extern_MapKey(EXECUTIONHOST)
-def_extern_MapKey(EXITCODE)
-def_extern_MapKey(HOLD)
-def_extern_MapKey(ID)
-def_extern_MapKey(INFILE)
-def_extern_MapKey(MAIL)
-def_extern_MapKey(MAXCPUTIME)
-def_extern_MapKey(MAXDISKSIZE)
-def_extern_MapKey(MAXRAMSIZE)
-def_extern_MapKey(MAXWALLTIME)
-def_extern_MapKey(MODIFICATIONTIME)
-def_extern_MapKey(NAME)
-def_extern_MapKey(NBPROC)
-def_extern_MapKey(OUTFILE)
-def_extern_MapKey(PID)
-def_extern_MapKey(QUEUE)
-def_extern_MapKey(QUEUEDTIME)
-def_extern_MapKey(SERVER)
-def_extern_MapKey(STARTTIME)
-def_extern_MapKey(STATE)
-def_extern_MapKey(TEXT)
-def_extern_MapKey(TMPDIR)
-def_extern_MapKey(USEDCPUTIME)
-def_extern_MapKey(USEDDISKSIZE)
-def_extern_MapKey(USEDRAMSIZE)
-def_extern_MapKey(USEDWALLTIME)
-def_extern_MapKey(USER)
-def_extern_MapKey(WORKDIR)
-def_extern_MapKey(HOMEDIR)
-
 #endif
index ff2dc82c0b8b71c84701e4258ad1e34074f72641..8120e426e9b91143560a622c29ab33bb7c6dedae 100644 (file)
@@ -70,15 +70,15 @@ int main(int argc, char** argv)
     Job job;
     // ... and its parameters ...
     Parametre p;
-    p["EXECUTABLE"]    = "source copied-test-script.sh";
-    p["NAME"]          = "Test_Local_RSH";
-    p["WORKDIR"]       = workdir;
-    p["INFILE"]        = Couple("seta.sh", "copied-seta.sh");
-    p["INFILE"]       += Couple("setb.sh", "copied-setb.sh");
-    p["INFILE"]       += Couple("test-script.sh", "copied-test-script.sh");
-    p["OUTFILE"]       = Couple("result.txt", "orig-result.txt");
-    p["EXECUTIONHOST"] = exechost;
-    p["USER"]          = user;
+    p[EXECUTABLE]    = "source copied-test-script.sh";
+    p[NAME]          = "Test_Local_RSH";
+    p[WORKDIR]       = workdir;
+    p[INFILE]        = Couple("seta.sh", "copied-seta.sh");
+    p[INFILE]       += Couple("setb.sh", "copied-setb.sh");
+    p[INFILE]       += Couple("test-script.sh", "copied-test-script.sh");
+    p[OUTFILE]       = Couple("result.txt", "orig-result.txt");
+    p[EXECUTIONHOST] = exechost;
+    p[USER]          = user;
     job.setParametre(p);
     // ... and its environment
     Environnement e;
@@ -104,7 +104,7 @@ int main(int argc, char** argv)
     string state = "Unknown";
     for (int i=0 ; i<timeout*10 && state != FINISHED && state != FAILED ; i++) {
       usleep(100000);
-      Versatile paramState = jobid.queryJob().getParametre()["STATE"];
+      Versatile paramState = jobid.queryJob().getParametre()[STATE];
       state = (paramState.size() > 0) ? paramState.str() : "Unknown";
       cout << "Job state is: " << state << endl;
     }
index b5ecc1a99f84f751c4a5ec07830c775a59e2e11c..f7ed8e4fa271eb3df7a9ab6c5b1eca161015d34e 100644 (file)
@@ -69,16 +69,16 @@ int main(int argc, char** argv)
     Job job;
     // ... and its parameters ...
     Parametre p;
-    p["EXECUTABLE"] = string("./copied-") + EXEC_TEST_NAME;
-    p["ARGUMENTS"]  = "copied-seta.sh";
-    p["ARGUMENTS"] += "copied-setb.sh";
-    p["ARGUMENTS"] += "orig-result.txt";
-    p["NAME"]       = "Test_Local_SH";
-    p["WORKDIR"]    = workdir;
-    p["INFILE"]     = Couple("seta.sh", "copied-seta.sh");
-    p["INFILE"]    += Couple("setb.sh", "copied-setb.sh");
-    p["INFILE"]    += Couple(EXEC_TEST_NAME, string("copied-") + EXEC_TEST_NAME);
-    p["OUTFILE"]    = Couple("result.txt", "orig-result.txt");
+    p[EXECUTABLE] = string("./copied-") + EXEC_TEST_NAME;
+    p[ARGUMENTS]  = "copied-seta.sh";
+    p[ARGUMENTS] += "copied-setb.sh";
+    p[ARGUMENTS] += "orig-result.txt";
+    p[NAME]       = "Test_Local_SH";
+    p[WORKDIR]    = workdir;
+    p[INFILE]     = Couple("seta.sh", "copied-seta.sh");
+    p[INFILE]    += Couple("setb.sh", "copied-setb.sh");
+    p[INFILE]    += Couple(EXEC_TEST_NAME, string("copied-") + EXEC_TEST_NAME);
+    p[OUTFILE]    = Couple("result.txt", "orig-result.txt");
     job.setParametre(p);
     // ... and its environment
     Environnement e;
@@ -104,7 +104,7 @@ int main(int argc, char** argv)
     string state = "Unknown";
     for (int i=0 ; i<timeout*10 && state != FINISHED && state != FAILED ; i++) {
       usleep(100000);
-      Versatile paramState = jobid.queryJob().getParametre()["STATE"];
+      Versatile paramState = jobid.queryJob().getParametre()[STATE];
       state = (paramState.size() > 0) ? paramState.str() : "Unknown";
       cout << "Job state is: " << state << endl;
     }
index 638b9b9e422eacaa07709edb45ae711428d34340..d216954e94f7699f0406782a42c2c709c7ec0252 100644 (file)
@@ -71,15 +71,15 @@ int main(int argc, char** argv)
     Job job;
     // ... and its parameters ...
     Parametre p;
-    p["EXECUTABLE"]    = "source copied-test-script.sh";
-    p["NAME"]          = "Test_Local_SSH";
-    p["WORKDIR"]       = workdir;
-    p["INFILE"]        = Couple("seta.sh", "copied-seta.sh");
-    p["INFILE"]       += Couple("setb.sh", "copied-setb.sh");
-    p["INFILE"]       += Couple("test-script.sh", "copied-test-script.sh");
-    p["OUTFILE"]       = Couple("result.txt", "orig-result.txt");
-    p["EXECUTIONHOST"] = exechost;
-    p["USER"]          = user;
+    p[EXECUTABLE]    = "source copied-test-script.sh";
+    p[NAME]          = "Test_Local_SSH";
+    p[WORKDIR]       = workdir;
+    p[INFILE]        = Couple("seta.sh", "copied-seta.sh");
+    p[INFILE]       += Couple("setb.sh", "copied-setb.sh");
+    p[INFILE]       += Couple("test-script.sh", "copied-test-script.sh");
+    p[OUTFILE]       = Couple("result.txt", "orig-result.txt");
+    p[EXECUTIONHOST] = exechost;
+    p[USER]          = user;
     job.setParametre(p);
     // ... and its environment (SSH_AUTH_SOCK env var is important for ssh agent authentication)
     Environnement e;
@@ -107,7 +107,7 @@ int main(int argc, char** argv)
     string state = "Unknown";
     for (int i=0 ; i<timeout*10 && state != FINISHED && state != FAILED ; i++) {
       usleep(100000);
-      Versatile paramState = jobid.queryJob().getParametre()["STATE"];
+      Versatile paramState = jobid.queryJob().getParametre()[STATE];
       state = (paramState.size() > 0) ? paramState.str() : "Unknown";
       cout << "Job state is: " << state << endl;
     }
index 5ceb09ff68825ce68c756438ce0320dab290bbdf..3af87f4c5dbe10f065d632e54c8f7399fc5fc14d 100644 (file)
@@ -81,16 +81,16 @@ int main(int argc, char** argv)
     Job job;
     // ... and its parameters ...
     Parametre p;
-    p["EXECUTABLE"]    = "test-script.sh";
-    p["NAME"]          = "Test_PBS";
-    p["INFILE"]        = Couple(workdir + "/seta.sh", "seta.sh");
-    p["INFILE"]       += Couple(workdir + "/setb.sh", "setb.sh");
-    p["OUTFILE"]       = Couple(workdir + "/result.txt", "result.txt");
-    p["USER"]          = user;
-    p["NBPROC"]        = 1;
-    p["MAXWALLTIME"]   = 1;
-    p["MAXRAMSIZE"]    = 4;
-    p["QUEUE"]         = queue;
+    p[EXECUTABLE]    = "test-script.sh";
+    p[NAME]          = "Test_PBS";
+    p[INFILE]        = Couple(workdir + "/seta.sh", "seta.sh");
+    p[INFILE]       += Couple(workdir + "/setb.sh", "setb.sh");
+    p[OUTFILE]       = Couple(workdir + "/result.txt", "result.txt");
+    p[USER]          = user;
+    p[NBPROC]        = 1;
+    p[MAXWALLTIME]   = 1;
+    p[MAXRAMSIZE]    = 4;
+    p[QUEUE]         = queue;
     job.setParametre(p);
     // ... and its environment
     Environnement e;
@@ -115,9 +115,9 @@ int main(int argc, char** argv)
     bool testTimeout = (timeout > -1);
     bool timeoutReached = (testTimeout && time >= timeout);
     JobInfo jinfo = jobid.queryJob();
-    string state = jinfo.getParametre()["STATE"].str();
+    string state = jinfo.getParametre()[STATE].str();
     cout << "State is \"" << state << "\"";
-    while (!timeoutReached && state != "U" && state != "C") {
+    while (!timeoutReached && state != FINISHED && state != FAILED) {
       cout << ", sleeping " << sleeptime << "s..." << endl;
       sleep(sleeptime);
       time += sleeptime;
@@ -128,12 +128,12 @@ int main(int argc, char** argv)
       if (sleeptime > MAX_SLEEP_TIME)
         sleeptime = MAX_SLEEP_TIME;
       jinfo = jobid.queryJob();
-      state = jinfo.getParametre()["STATE"].str();
+      state = jinfo.getParametre()[STATE].str();
       cout << "State is \"" << state << "\"";
     }
     cout << endl;
 
-    if (state == "U" || state == "C") {
+    if (state == FINISHED || state == FAILED) {
       cout << "Job " << jobid.__repr__() << " is done" << endl;
     } else {
       cerr << "Timeout while executing job" << endl;
index b770668c8826a49a9f4ca704b5f1f11a38b701f8..1f7863298b998781e9819a9237b8f72d61af7f6c 100644 (file)
@@ -97,19 +97,19 @@ int main(int argc, char** argv)
     Job job;
     // ... and its parameters ...
     Parametre p;
-    p["EXECUTABLE"]    = "./test-script.sh";
-    p["NAME"]          = string("Test_ePBS_") + argv[1];
-    p["WORKDIR"]       = homedir + "/tmp/Batch";
-    p["INFILE"]        = Couple("seta.sh", "tmp/Batch/seta.sh");
-    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"]    = 1000;
-    p["HOMEDIR"]       = homedir;
-    p["QUEUE"]         = queue;
+    p[EXECUTABLE]    = "./test-script.sh";
+    p[NAME]          = string("Test_ePBS_") + argv[1];
+    p[WORKDIR]       = homedir + "/tmp/Batch";
+    p[INFILE]        = Couple("seta.sh", "tmp/Batch/seta.sh");
+    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]    = 1000;
+    p[HOMEDIR]       = homedir;
+    p[QUEUE]         = queue;
     job.setParametre(p);
     // ... and its environment
     Environnement e;
@@ -134,7 +134,7 @@ int main(int argc, char** argv)
     bool testTimeout = (timeout > -1);
     bool timeoutReached = (testTimeout && time >= timeout);
     JobInfo jinfo = jobid.queryJob();
-    string state = jinfo.getParametre()["STATE"].str();
+    string state = jinfo.getParametre()[STATE].str();
     cout << "State is \"" << state << "\"";
     while (!timeoutReached && state != FINISHED && state != FAILED) {
       cout << ", sleeping " << sleeptime << "s..." << endl;
@@ -147,7 +147,7 @@ int main(int argc, char** argv)
       if (sleeptime > MAX_SLEEP_TIME)
         sleeptime = MAX_SLEEP_TIME;
       jinfo = jobid.queryJob();
-      state = jinfo.getParametre()["STATE"].str();
+      state = jinfo.getParametre()[STATE].str();
       cout << "State is \"" << state << "\"";
     }
     cout << endl;
index b013b0b5b4c2ba9a288af4f42fc3a68bef6bd3d2..4427bab27bc95587ac3d8cfda914454a17916490 100644 (file)
@@ -42,13 +42,13 @@ def work():
     job = Job()
     # ... and its parameters ...
     p = {}
-    p['EXECUTABLE'] = './copied-' + config.EXEC_TEST_NAME
-    p["ARGUMENTS"]  = ["copied-seta.sh", "copied-setb.sh", "orig-result.txt"];
-    p['NAME'] = 'Test_Python_Local_SH'
-    p['WORKDIR'] = config.TEST_LOCAL_SH_WORK_DIR
-    p['INFILE'] = [('seta.sh', 'copied-seta.sh'), ('setb.sh', 'copied-setb.sh'),
+    p[EXECUTABLE] = './copied-' + config.EXEC_TEST_NAME
+    p[ARGUMENTS]  = ["copied-seta.sh", "copied-setb.sh", "orig-result.txt"];
+    p[NAME] = 'Test_Python_Local_SH'
+    p[WORKDIR] = config.TEST_LOCAL_SH_WORK_DIR
+    p[INFILE] = [('seta.sh', 'copied-seta.sh'), ('setb.sh', 'copied-setb.sh'),
                    (config.EXEC_TEST_FULL_PATH, 'copied-' + config.EXEC_TEST_NAME)]
-    p['OUTFILE'] = [('result.txt', 'orig-result.txt')]
+    p[OUTFILE] = [('result.txt', 'orig-result.txt')]
     job.setParametre(p)
     # ... and its environment
     e = {}
@@ -76,7 +76,7 @@ def work():
         i+=1
         jinfo = jobid.queryJob()
         try:
-            state = jinfo.getParametre()['STATE']
+            state = jinfo.getParametre()[STATE]
         except KeyError:
             pass
         print "State is", state