Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
LHCData
lhc-sm-hwc
Commits
722a29b9
Commit
722a29b9
authored
Oct 28, 2021
by
Agata Chadaj
Browse files
wip
parent
6d272853
Pipeline
#3175864
canceled with stage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CI/send_results.py
View file @
722a29b9
"""This script is a workaround as we didn't manage to install papermill as script in the Jenkins pipeline"""
import
json
from
pathlib
import
Path
import
pandas
as
pd
import
argparse
import
nbformat
from
lhcsmapi
import
Time
from
lhcsmnb
import
outputs
,
parameters
def
_get_arg_parser
():
...
...
@@ -24,23 +24,24 @@ def get_result():
result_nb
=
nbformat
.
read
(
result_path
,
as_version
=
4
)
nb
=
outputs
.
NotebookOutput
(
result_nb
)
try
:
summary
=
nb
.
get_cells_by_tag
(
'result'
)[
0
].
get_cell_output
(
outputs
.
CellOutputType
.
STDOUT
)[
0
]
result_flag
=
nb
.
get_cells_by_tag
(
'result'
)[
1
].
get_cell_output
(
outputs
.
CellOutputType
.
STDOUT
)[
0
]
print
(
'result_flag: '
+
result_flag
)
full_result
=
nb
.
get_cells_by_tag
(
'result'
)[
0
].
get_cell_output
(
outputs
.
CellOutputType
.
STDOUT
)[
0
]
print
(
'full_result: '
+
full_result
)
except
IndexError
:
return
'FAILED'
,
''
return
result_flag
,
full_result
return
result_flag
,
summary
def
save_json_to_file
(
args
,
flag
,
comment
):
file_path
=
'/eos/home-m/mpesoft/
test
.csv'
file_path
=
'/eos/home-m/mpesoft/
'
+
':'
.
join
(
args
.
notebook
,
args
.
circuit_name
,
args
.
discharge_level
,
Time
.
to_unix_timestamp
(
args
.
start_time
),
Time
.
to_unix_timestamp
(
args
.
end_time
),
flag
)
+
'
.csv'
df
=
pd
.
DataFrame
(
eval
(
comment
))
df
.
to_csv
(
file_path
)
with
open
(
file_path
,
'a'
)
as
f
:
df
.
to_csv
(
f
,
mode
=
'a'
,
header
=
f
.
tell
()
==
0
)
if
__name__
==
'__main__'
:
args
=
_get_arg_parser
().
parse_args
()
print
(
'args: '
)
print
(
args
)
flag
,
text
=
get_result
()
save_json_to_file
(
args
,
flag
,
text
)
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