Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
dcdb
dcdb
Commits
b51dc366
Commit
b51dc366
authored
Aug 11, 2020
by
Michael Ott
Browse files
Add additional columns to job list outputs, pretty print job start/end times in job show
parent
82f02675
Changes
2
Hide whitespace changes
Inline
Side-by-side
tools/dcdbconfig/jobaction.cpp
View file @
b51dc366
...
...
@@ -112,11 +112,13 @@ void JobAction::doShow(std::string jobId) {
switch
(
err
)
{
case
DCDB
::
JD_OK
:
std
::
cout
<<
"Job ID: "
<<
jobId
<<
std
::
endl
;
std
::
cout
<<
"User ID: "
<<
jobData
.
userId
<<
std
::
endl
;
std
::
cout
<<
"Start Time: "
<<
jobData
.
startTime
.
getRaw
()
<<
std
::
endl
;
std
::
cout
<<
"End Time: "
<<
jobData
.
endTime
.
getRaw
()
<<
std
::
endl
;
std
::
cout
<<
"Node List: "
;
jobData
.
startTime
.
convertToLocal
();
jobData
.
endTime
.
convertToLocal
();
std
::
cout
<<
"Job ID: "
<<
jobId
<<
std
::
endl
;
std
::
cout
<<
"User ID: "
<<
jobData
.
userId
<<
std
::
endl
;
std
::
cout
<<
"Start Time: "
<<
jobData
.
startTime
.
getString
()
<<
" ("
<<
jobData
.
startTime
.
getRaw
()
<<
")"
<<
std
::
endl
;
std
::
cout
<<
"End Time: "
<<
jobData
.
endTime
.
getString
()
<<
" ("
<<
jobData
.
endTime
.
getRaw
()
<<
")"
<<
std
::
endl
;
std
::
cout
<<
"Node List: "
;
nIt
=
jobData
.
nodes
.
begin
();
if
(
nIt
!=
jobData
.
nodes
.
end
())
{
std
::
cout
<<
*
nIt
;
...
...
@@ -139,6 +141,14 @@ void JobAction::doShow(std::string jobId) {
}
}
void
JobAction
::
printList
(
std
::
list
<
DCDB
::
JobData
>&
jobList
)
{
std
::
cout
<<
"Job ID, User ID, Start Time, End Time, #Nodes"
<<
std
::
endl
;
for
(
const
auto
&
j
:
jobList
)
{
std
::
cout
<<
j
.
jobId
<<
","
<<
j
.
userId
<<
","
<<
j
.
startTime
.
getRaw
()
<<
","
<<
j
.
endTime
.
getRaw
()
<<
","
<<
j
.
nodes
.
size
()
<<
std
::
endl
;
}
std
::
cout
<<
std
::
endl
;
}
void
JobAction
::
doList
()
{
DCDB
::
JobDataStore
jobDataStore
(
connection
);
DCDB
::
TimeStamp
tsEnd
((
uint64_t
)
LLONG_MAX
);
...
...
@@ -147,11 +157,7 @@ void JobAction::doList() {
DCDB
::
JDError
err
=
jobDataStore
.
getJobsInIntervalIncl
(
jobList
,
tsStart
,
tsEnd
);
switch
(
err
)
{
case
DCDB
::
JD_OK
:
std
::
cout
<<
"Job ID, User ID"
<<
std
::
endl
;
for
(
const
auto
&
j
:
jobList
)
{
std
::
cout
<<
j
.
jobId
<<
","
<<
j
.
userId
<<
std
::
endl
;
}
std
::
cout
<<
std
::
endl
;
printList
(
jobList
);
break
;
default:
std
::
cout
<<
"Internal error."
<<
std
::
endl
;
...
...
@@ -167,13 +173,8 @@ void JobAction::doPending() {
DCDB
::
JDError
err
=
jobDataStore
.
getJobsInIntervalIncl
(
jobList
,
tsStart
,
tsEnd
);
switch
(
err
)
{
case
DCDB
::
JD_OK
:
std
::
cout
<<
"Job ID, User ID"
<<
std
::
endl
;
for
(
const
auto
&
j
:
jobList
)
{
if
(
j
.
startTime
.
getRaw
()
>
tsNow
.
getRaw
()
||
j
.
startTime
.
getRaw
()
==
0
)
std
::
cout
<<
j
.
jobId
<<
","
<<
j
.
userId
<<
std
::
endl
;
}
std
::
cout
<<
std
::
endl
;
break
;
printList
(
jobList
);
break
;
default:
std
::
cout
<<
"Internal error."
<<
std
::
endl
;
}
...
...
@@ -187,12 +188,8 @@ void JobAction::doRunning() {
DCDB
::
JDError
err
=
jobDataStore
.
getJobsInIntervalRunning
(
jobList
,
tsStart
,
tsEnd
);
switch
(
err
)
{
case
DCDB
::
JD_OK
:
std
::
cout
<<
"Job ID, User ID"
<<
std
::
endl
;
for
(
const
auto
&
j
:
jobList
)
{
std
::
cout
<<
j
.
jobId
<<
","
<<
j
.
userId
<<
std
::
endl
;
}
std
::
cout
<<
std
::
endl
;
break
;
printList
(
jobList
);
break
;
default:
std
::
cout
<<
"Internal error."
<<
std
::
endl
;
}
...
...
@@ -207,13 +204,8 @@ void JobAction::doFinished() {
DCDB
::
JDError
err
=
jobDataStore
.
getJobsInIntervalExcl
(
jobList
,
tsStart
,
tsEnd
);
switch
(
err
)
{
case
DCDB
::
JD_OK
:
std
::
cout
<<
"Job ID, User ID"
<<
std
::
endl
;
for
(
const
auto
&
j
:
jobList
)
{
if
(
j
.
startTime
.
getRaw
()
!=
0
&&
j
.
endTime
.
getRaw
()
!=
0
)
std
::
cout
<<
j
.
jobId
<<
","
<<
j
.
userId
<<
std
::
endl
;
}
std
::
cout
<<
std
::
endl
;
break
;
printList
(
jobList
);
break
;
default:
std
::
cout
<<
"Internal error."
<<
std
::
endl
;
}
...
...
tools/dcdbconfig/jobaction.h
View file @
b51dc366
...
...
@@ -58,7 +58,9 @@ protected:
void
doRunning
();
void
doFinished
();
void
doPending
();
private:
void
printList
(
std
::
list
<
DCDB
::
JobData
>&
jobList
);
};
#endif
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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