Skip to content

Commit

Permalink
check scratch_dir exists
Browse files Browse the repository at this point in the history
  • Loading branch information
burnout87 committed Oct 20, 2023
1 parent 90f6429 commit 77afff2
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions cdci_data_analysis/flask_app/dispatcher_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Check warning on line 487 in cdci_data_analysis/flask_app/dispatcher_query.py

View check run for this annotation

Codecov / codecov/patch

cdci_data_analysis/flask_app/dispatcher_query.py#L487

Added line #L487 was not covered by tests

logger.info("found records: %s", len(records))

Expand Down

0 comments on commit 77afff2

Please sign in to comment.