Commit 722a29b9 authored by Agata Chadaj's avatar Agata Chadaj
Browse files


parent 6d272853
Pipeline #3175864 canceled with stage
"""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 =, as_version=4)
nb = outputs.NotebookOutput(result_nb)
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))
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: ')
flag, text = get_result()
save_json_to_file(args, flag, text)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment