fix polar handling

This commit is contained in:
Ruben Fiszel
2023-04-04 14:25:27 +02:00
parent 15c75d9d00
commit b86ca29fde
2 changed files with 6 additions and 3 deletions
-1
View File
@@ -1398,7 +1398,6 @@ pub async fn run_wait_result_job_by_path_get(
Path((w_id, script_path)): Path<(String, StripPath)>,
Query(run_query): Query<RunJobQuery>,
) -> error::JsonResult<serde_json::Value> {
tracing::error!("run_wait_result_job_by_path_get {:#?}", run_query.payload);
let payload_r = run_query
.payload
.map(decode_payload)
+6 -2
View File
@@ -1918,8 +1918,12 @@ for k, v in list(args.items()):
try:
res = inner_script.main(**args)
if type(res).__name__ == 'DataFrame':
res = res.values.tolist()
typ = type(res)
if typ.__name__ == 'DataFrame':
if typ.__module__ == 'pandas.core.frame':
res = res.values.tolist()
elif typ.__module__ == 'polars.dataframe.frame':
res = res.rows()
res_json = json.dumps(res, separators=(',', ':'), default=str).replace('\n', '')
with open("result.json", 'w') as f:
f.write(res_json)