Currently job artifacts in CI/CD pipelines on LRZ GitLab never expire. Starting from Wed 26.1.2022 the default expiration time will be 30 days (GitLab default). Currently existing artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

Commit 4b876ed5 authored by Michael Ott's avatar Michael Ott
Browse files

Check whether dcdbslurmjob runs in slurmd context and execute only on first node in nodelist

parent bd79521e
......@@ -95,6 +95,7 @@ void usage() {
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 << " -f Force job insert/update [default: no]" << std::endl;
std::cout << std::endl;
std::cout << " -h This help page" << std::endl;
std::cout << std::endl;
......@@ -263,10 +264,11 @@ int main(int argc, char** argv) {
std::string domainId = JOB_DEFAULT_DOMAIN;
std::string substitution="";
int maxJobLength = -1;
bool force = false;
uint64_t ts=0;
// Defining options
const char *opts = "b:q:o:c:u:p:n:t:d:j:i:s:m:h";
const char *opts = "b:q:o:c:u:p:n:t:d:j:i:s:m:fh";
char ret;
while ((ret = getopt(argc, argv, opts))!=-1) {
......@@ -349,12 +351,30 @@ int main(int argc, char** argv) {
case 'm':
maxJobLength = std::stoull(optarg);
break;
case 'f':
force = true;
break;
case 'h':
default:
usage();
return 1;
}
}
// Check whether we are started by slurmd and are the first node in the nodelist
std::string slurmNodename = getEnv("SLURMD_NODENAME");
std::string slurmNodelist = getEnv("SLURM_JOB_NODELIST");
if (slurmNodelist == "") {
slurmNodelist = getEnv("SLURM_NODELIST");
}
DCDB::NodeList nl;
splitNodeList(slurmNodelist, nl);
if (!force && (slurmNodename.size() > 0)) {
if (slurmNodename != nl.front()) {
std::cout << "Running in slurmd context but not the first node in nodelist. Exiting." << std::endl;
return 0;
}
}
if (hostList.size() == 0) {
hostList.push_back("localhost");
......@@ -460,22 +480,19 @@ int main(int argc, char** argv) {
}
}
DCDB::NodeList nl, pnl;
DCDB::NodeList pnl;
if (start) {
if(nodelist=="") {
nodelist = getEnv("SLURM_JOB_NODELIST");
if (nodelist == "") {
nodelist = getEnv("SLURM_NODELIST");
}
// Check whether a nodelist was provided as command line argument.
// Otherwise we have populated nl above already.
if(nodelist.size() > 0) {
splitNodeList(nodelist, nl);
}
convertNodeList(nl, substitution);
// Getting the whole pack's node list, if necessary
if(isPackLeader) {
pnodelist = getEnv("SLURM_PACK_JOB_NODELIST");
}
}
splitNodeList(nodelist, nl);
convertNodeList(nl, substitution);
std::cout << "DOMAINID = " << domainId << std::endl;
std::cout << "JOBID = " << jobId << std::endl;
std::cout << "USER = " << userId << 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