Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
dcdb
dcdb
Commits
d3e7b6d5
Commit
d3e7b6d5
authored
Jul 12, 2019
by
Michael Ott
Browse files
Add initial dcdbslurmjob tool to read Slurm job data from environment
parent
ab3b17e3
Changes
3
Hide whitespace changes
Inline
Side-by-side
tools/Makefile
View file @
d3e7b6d5
include
../config.mk
PROJECTS
=
dcdbconfig dcdbquery dcdbunitconv dcdbquerysum dcdbcsvimport
PROJECTS
=
dcdbconfig dcdbquery dcdbunitconv dcdbquerysum dcdbcsvimport
dcdbslurmjob
.PHONY
:
clean install $(PROJECTS)
...
...
tools/dcdbslurmjob/Makefile
0 → 100644
View file @
d3e7b6d5
include
../../config.mk
CXXFLAGS
+=
-I
../../common/include/
-I
../../lib/include
-I
$(DCDBDEPLOYPATH)
/include
OBJS
=
dcdbslurmjob.o
TARGET
=
dcdbslurmjob
.PHONY
:
clean install
$(TARGET)
:
$(OBJS)
$(CXX)
-o
$(TARGET)
$(OBJS)
$(LIBS)
all
:
$(TARGET)
clean
:
rm
-f
$(TARGET)
rm
-f
$(OBJS)
install
:
$(TARGET)
install
$(TARGET)
$(DCDBDEPLOYPATH)
/bin/
tools/dcdbslurmjob/dcdbslurmjob.cpp
0 → 100644
View file @
d3e7b6d5
//================================================================================
// 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
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment