From 77afff2c16d8b3df8a0344a6aa7796eede8faf73 Mon Sep 17 00:00:00 2001 From: burnout87 Date: Fri, 20 Oct 2023 12:25:13 +0200 Subject: [PATCH] check scratch_dir exists --- .../flask_app/dispatcher_query.py | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/cdci_data_analysis/flask_app/dispatcher_query.py b/cdci_data_analysis/flask_app/dispatcher_query.py index db336fe48..f580d5b38 100644 --- a/cdci_data_analysis/flask_app/dispatcher_query.py +++ b/cdci_data_analysis/flask_app/dispatcher_query.py @@ -473,16 +473,18 @@ def inspect_state(app): if job_id is not None: if r.group('job_id')[:8] != job_id: continue - - if os.path.exists(scratch_dir) and (time_.time() - os.stat(scratch_dir).st_mtime) < recent_days * 24 * 3600: - records.append(dict( - mtime=os.stat(scratch_dir).st_mtime, - ctime=os.stat(scratch_dir).st_ctime, - session_id=r.group('session_id'), - job_id=r.group('job_id'), - aliased_marker=r.group('aliased_marker'), - **InstrumentQueryBackEnd.read_scratch_dir(scratch_dir) - )) + if os.path.exists(scratch_dir): + if (time_.time() - os.stat(scratch_dir).st_mtime) < recent_days * 24 * 3600: + records.append(dict( + mtime=os.stat(scratch_dir).st_mtime, + ctime=os.stat(scratch_dir).st_ctime, + session_id=r.group('session_id'), + job_id=r.group('job_id'), + aliased_marker=r.group('aliased_marker'), + **InstrumentQueryBackEnd.read_scratch_dir(scratch_dir) + )) + else: + logger.warning(f"scratch_dir {scratch_dir} not existing, cannot be inspected") logger.info("found records: %s", len(records))