decl_extern_Constant(NBPROC);
decl_extern_Constant(NBPROCPERNODE);
decl_extern_Constant(OUTFILE);
- decl_extern_Constant(PID);
decl_extern_Constant(QUEUE);
decl_extern_Constant(STATE);
decl_extern_Constant(WORKDIR);
- decl_extern_Constant(HOMEDIR);
decl_extern_Constant(EXCLUSIVE);
// These constants define the status of a job (parameter STATE)
addParameter("NBPROC", LONG, 1);
addParameter("NBPROCPERNODE", LONG, 1);
addParameter("OUTFILE", COUPLE, 0);
- addParameter("PID", LONG, 1);
addParameter("QUEUE", STRING, 1);
addParameter("STATE", STRING, 1);
addParameter("WORKDIR", STRING, 1);
- addParameter("HOMEDIR", STRING, 1);
addParameter("EXCLUSIVE", BOOL, 1);
}
tempOutputFile << "#!/bin/sh" << endl;
tempOutputFile << "cd " << workDir << endl;
- // Optional parameters
- //if (param.find(MAXWALLTIME) != param.end())
- // tempOutputFile << "#SBATCH --time=" << param[MAXWALLTIME] << endl;
- //if (param.find(MAXRAMSIZE) != param.end())
- // tempOutputFile << "#SBATCH --mem=" << param[MAXRAMSIZE] << endl;
+ // Optional parameters (system limits on the job process)
+ if (param.find(MAXCPUTIME) != param.end()) {
+ long maxcputime = (long)param[MAXCPUTIME] * 60;
+ tempOutputFile << "ulimit -H -t " << maxcputime << endl;
+ }
+
+ if (param.find(MAXDISKSIZE) != param.end()) {
+ long maxdisksize = (long)param[MAXDISKSIZE] * 1024;
+ tempOutputFile << "ulimit -H -f " << maxdisksize << endl;
+ }
+
+ if (param.find(MAXRAMSIZE) != param.end()) {
+ long maxramsize = (long)param[MAXRAMSIZE] * 1024;
+ tempOutputFile << "ulimit -H -v " << maxramsize << endl;
+ }
// Define environment for the job
Environnement env = job.getEnvironnement();
id_sst << _id;
param[ID] = id_sst.str();
param[STATE] = Batch::RUNNING;
-#ifndef WIN32
- param[PID] = child;
-#endif
_bm._threads[_id].thread_id = thread_id;
#ifndef WIN32
argv[command.size()] = NULL;
UNDER_LOCK( cout << "*** debug_command = " << comstr << endl );
- // On positionne les limites systeme imposees au fils
- // This part is deactivated because those limits should be set on the job process, not on
- // the ssh process. If it is done properly one day, beware of the types used (int is not enough)
- /*
- if (param.find(MAXCPUTIME) != param.end()) {
- int maxcputime = param[MAXCPUTIME];
- struct rlimit limit;
- limit.rlim_cur = maxcputime;
- limit.rlim_max = int(maxcputime * 1.1);
- setrlimit(RLIMIT_CPU, &limit);
- }
-
- if (param.find(MAXDISKSIZE) != param.end()) {
- int maxdisksize = param[MAXDISKSIZE];
- struct rlimit limit;
- limit.rlim_cur = maxdisksize * 1024;
- limit.rlim_max = int(maxdisksize * 1.1) * 1024;
- setrlimit(RLIMIT_FSIZE, &limit);
- }
-
- if (param.find(MAXRAMSIZE) != param.end()) {
- int maxramsize = param[MAXRAMSIZE];
- struct rlimit limit;
- limit.rlim_cur = maxramsize * 1024 * 1024;
- limit.rlim_max = int(maxramsize * 1.1) * 1024 * 1024;
- setrlimit(RLIMIT_AS, &limit);
- }
- */
-
// On cree une session pour le fils de facon a ce qu'il ne soit pas
// detruit lorsque le shell se termine (le shell ouvre une session et
// tue tous les process appartenant a la session en quittant)