OasisLMF / OasisPlatform

Loss modelling platform.
BSD 3-Clause "New" or "Revised" License
40 stars 17 forks source link

V2 worker monitor - error when ktools logs are missing #1025

Closed sambles closed 5 months ago

sambles commented 5 months ago

Issue Description

The PR https://github.com/OasisLMF/OasisPlatform/pull/994 fixed the missing ktools log dir tar in version 2.3.2

 src/model_execution_worker/distributed_tasks.py
983:        'run_logs': filestore.put(os.path.join(res['model_run_dir'], 'log'), arcname='logs'),

src/server/oasisapi/analyses/v2_api/tasks.py
549:    analysis.run_log_file = store_file(result['run_logs'], 'application/gzip', initiator, filename=f'analysis_{analysis_id}_logs.tar.gz')

When a V2-worker-monitor processes a generate losses return from a coreoasis/model_worker:2.3.0 image then analyses will fail with

 === Trace Back ===
KeyError: ‘run_logs’

Add handling so that analyses don't fail when this happens. Instead skip attaching the log tar and continue