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

dcdbslurmjob.cpp 2.34 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//================================================================================
// Name        : dcdbslurmjob.cpp
// Author      : Michael Ott
// Copyright   : Leibniz Supercomputing Centre
// Description : Main file of the dcdbslurmjob command line utility
//================================================================================

//================================================================================
// This file is part of DCDB (DataCenter DataBase)
// Copyright (C) 2011-2019 Leibniz Supercomputing Centre
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
//================================================================================

#include <cstdlib>
#include <iostream>
#include <boost/algorithm/string.hpp>
#include "timestamp.h"

std::string getEnv(const char* var) {
    char* str = std::getenv(var);
    if (str != NULL) {
	return std::string(str);
    } else {
	return std::string("");
    }
}

int main(int argc, char** argv) {
    std::cout << "dcdbslurmjob " << VERSION << std::endl << std::endl;
    
    if (argc != 2) {
	std::cerr << "One argument is required: start or stop" << std::endl;
	return 1;
    }
    
    uint64_t ts = getTimestamp();
    std::string jobId = getEnv("SLURM_JOB_ID");
    if (boost::iequals(argv[1], "start")) {
	std::string user = getEnv("SLURM_JOB_USER");
	std::string nodeList = getEnv("SLURM_JOB_NODELIST");
	std::cout << "START: ts=" << ts << " jobId=" << jobId << " user=" << user << " nodelist=" << nodeList << std::endl;
    } else if (boost::iequals(argv[1], "stop")) {
	std::cout << "STOP: ts=" << ts << " jobId=" << jobId << std::endl;
    } else {
	std::cerr << "Unknown argument: " << argv[1] << std::endl;
    }
    
    return 0;
}