Skip to content

PO crashes when no analysis returned during status update #23

@brucetony

Description

@brucetony
INFO:     192.168.1.12:59984 - "GET /po/healthz HTTP/1.1" 200 OK
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/app/src/main.py", line 38, in <module>
    main()
  File "/app/src/main.py", line 29, in main
    status_loop(database, int(os.getenv('STATUS_LOOP_INTERVAL')))
  File "/app/src/status/status.py", line 72, in status_loop
    analysis_status = _get_analysis_status(analysis_id, database)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/src/status/status.py", line 103, in _get_analysis_status
    db_status = analysis.status
                ^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'status'

Sometimes when calling for a status update for a given analysis, the database does not return an analysis, here is the code where the error occurs:

def _get_analysis_status(analysis_id: str, database: Database) -> dict[str, str]:
    analysis = database.get_latest_deployment(analysis_id)
    db_status = analysis.status

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions