From ff753b72d7ba881436e203e6cd88db7f161204cf Mon Sep 17 00:00:00 2001 From: barate Date: Wed, 27 Jan 2010 16:49:20 +0000 Subject: [PATCH] Removed old constants defined in global namespace. Warning: this change will break compilation of Salome Kernel older than V5_1_main_20100127. --- src/Core/Batch_Parametre.cxx | 42 ---------------------- src/Core/Batch_Parametre.hxx | 48 ------------------------- src/Local/Test/Test_Local_RSH.cxx | 20 +++++------ src/Local/Test/Test_Local_SH.cxx | 22 ++++++------ src/Local/Test/Test_Local_SSH.cxx | 20 +++++------ src/PBS/Test/Test_PBS.cxx | 28 +++++++-------- src/PBS/Test/Test_ePBS.cxx | 30 ++++++++-------- src/Python/Test/Test_Python_Local_SH.py | 14 ++++---- 8 files changed, 67 insertions(+), 157 deletions(-) diff --git a/src/Core/Batch_Parametre.cxx b/src/Core/Batch_Parametre.cxx index 3031517..b4775a0 100644 --- a/src/Core/Batch_Parametre.cxx +++ b/src/Core/Batch_Parametre.cxx @@ -34,48 +34,6 @@ 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 diff --git a/src/Core/Batch_Parametre.hxx b/src/Core/Batch_Parametre.hxx index 4ba9f7b..b3c11ad 100644 --- a/src/Core/Batch_Parametre.hxx +++ b/src/Core/Batch_Parametre.hxx @@ -36,14 +36,8 @@ #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 diff --git a/src/Local/Test/Test_Local_RSH.cxx b/src/Local/Test/Test_Local_RSH.cxx index ff2dc82..8120e42 100644 --- a/src/Local/Test/Test_Local_RSH.cxx +++ b/src/Local/Test/Test_Local_RSH.cxx @@ -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 0) ? paramState.str() : "Unknown"; cout << "Job state is: " << state << endl; } diff --git a/src/Local/Test/Test_Local_SH.cxx b/src/Local/Test/Test_Local_SH.cxx index b5ecc1a..f7ed8e4 100644 --- a/src/Local/Test/Test_Local_SH.cxx +++ b/src/Local/Test/Test_Local_SH.cxx @@ -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 0) ? paramState.str() : "Unknown"; cout << "Job state is: " << state << endl; } diff --git a/src/Local/Test/Test_Local_SSH.cxx b/src/Local/Test/Test_Local_SSH.cxx index 638b9b9..d216954 100644 --- a/src/Local/Test/Test_Local_SSH.cxx +++ b/src/Local/Test/Test_Local_SSH.cxx @@ -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 0) ? paramState.str() : "Unknown"; cout << "Job state is: " << state << endl; } diff --git a/src/PBS/Test/Test_PBS.cxx b/src/PBS/Test/Test_PBS.cxx index 5ceb09f..3af87f4 100644 --- a/src/PBS/Test/Test_PBS.cxx +++ b/src/PBS/Test/Test_PBS.cxx @@ -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; diff --git a/src/PBS/Test/Test_ePBS.cxx b/src/PBS/Test/Test_ePBS.cxx index b770668..1f78632 100644 --- a/src/PBS/Test/Test_ePBS.cxx +++ b/src/PBS/Test/Test_ePBS.cxx @@ -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; diff --git a/src/Python/Test/Test_Python_Local_SH.py b/src/Python/Test/Test_Python_Local_SH.py index b013b0b..4427bab 100644 --- a/src/Python/Test/Test_Python_Local_SH.py +++ b/src/Python/Test/Test_Python_Local_SH.py @@ -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 -- 2.39.2