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

wip

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 = 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)
Markdown is supported
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