Commit a984d75e authored by Michael Ott's avatar Michael Ott

Add parameter -m to specify maximum job length to be used for end_ts in start

parent 5da108d7
......@@ -72,6 +72,7 @@ void usage() {
std::cout << " -j<jobid> Numerical job id [default: SLURM_JOB_ID var]" << std::endl;
std::cout << " -i<userid> Numerical user id [default: SLURM_JOB_USER var]" << std::endl;
std::cout << " -s<pattern> Nodelist substitution pattern [default: none]" << std::endl;
std::cout << " -m<pattern> Maximum job length in h [default: none]" << std::endl;
std::cout << std::endl;
std::cout << " -h This help page" << std::endl;
std::cout << std::endl;
......@@ -172,11 +173,12 @@ int main(int argc, char** argv) {
int port;
std::string nodelist="", jobId="", userId="";
std::string substitution="";
int maxJobLength = -1;
int qos = 0;
uint64_t ts=0;
// Defining options
const char *opts = "b:q:c:u:p:n:t:j:i:s:h";
const char *opts = "b:q:c:u:p:n:t:j:i:s:m:h";
char ret;
while ((ret = getopt(argc, argv, opts))!=-1) {
......@@ -244,8 +246,12 @@ int main(int argc, char** argv) {
substitution = optarg;
if (substitution == "SNG") {
substitution = "s%([fi][0-9]{2})(r[0-9]{2})(c[0-9]{2})(s[0-9]{2})%/sng/\\1/\\2/\\3/\\4%";
maxJobLength = 48;
}
break;
case 'm':
maxJobLength = std::stoull(optarg);
break;
case 'h':
default:
usage();
......@@ -332,6 +338,9 @@ int main(int argc, char** argv) {
std::cout << "START = " << ts << std::endl;
std::cout << "NODELIST = " << nodelist << std::endl;
std::cout << "SUBST = " << substitution << std::endl;
if (maxJobLength >= 0) {
std::cout << "JOBLEN = " << maxJobLength << std::endl;
}
std::cout << "NODES =";
for (auto &n: nl) {
std::cout << " " << n;
......@@ -344,7 +353,7 @@ int main(int argc, char** argv) {
jd.jobId = jobId;
jd.userId = userId;
jd.startTime = DCDB::TimeStamp(ts);
jd.endTime = DCDB::TimeStamp((uint64_t)0);
jd.endTime = (maxJobLength >= 0) ? DCDB::TimeStamp(ts + S_TO_NS(maxJobLength * 3600) + 1) : DCDB::TimeStamp((uint64_t)0);
jd.nodes = nl;
} catch(const std::invalid_argument& e) {
std::cerr << "Invalid input format!" << std::endl;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment