Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Krish Moodbidri
rc-scripts
Commits
9fc46275
Commit
9fc46275
authored
Feb 19, 2019
by
Krish Moodbidri
Browse files
calculate wait time between SLURM job submit and job start; using pandas
parents
Changes
1
Hide whitespace changes
Inline
Side-by-side
sacct_submit_to_start_time_calculator.ipynb
0 → 100644
View file @
9fc46275
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"!sacct -u $USER -o JobID, Submit,Start --starttime $MM/$DD -n > $FILE"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import datetime\n",
"import csv\n",
"import pandas as pd\n",
"with open($FILE) as csvfile:\n",
" readCSV = csv.reader(csvfile, delimiter=' ')\n",
" for row in readCSV:\n",
" d1 = pd.to_datetime(row[0], format='%Y-%m-%dT%H:%M:%S')\n",
" d2 = pd.to_datetime(row[1], format='%Y-%m-%dT%H:%M:%S')\n",
" print(d2-d1)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.2"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
%% Cell type:code id: tags:
```
python
!
sacct
-
u
$
USER
-
o
JobID
,
Submit
,
Start
--
starttime
$
MM
/
$
DD
-
n
>
$
FILE
```
%% Cell type:code id: tags:
```
python
import
datetime
import
csv
import
pandas
as
pd
with
open
(
$
FILE
)
as
csvfile
:
readCSV
=
csv
.
reader
(
csvfile
,
delimiter
=
' '
)
for
row
in
readCSV
:
d1
=
pd
.
to_datetime
(
row
[
0
],
format
=
'%Y-%m-%dT%H:%M:%S'
)
d2
=
pd
.
to_datetime
(
row
[
1
],
format
=
'%Y-%m-%dT%H:%M:%S'
)
print
(
d2
-
d1
)
```
%% Cell type:code id: tags:
```
python
```
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