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
#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 >
}
-// 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
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;
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;
}
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;
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;
}
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;
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;
}
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;
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;
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;
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;
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;
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;
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 = {}
i+=1
jinfo = jobid.queryJob()
try:
- state = jinfo.getParametre()['STATE']
+ state = jinfo.getParametre()[STATE]
except KeyError:
pass
print "State is", state