Retrieves the current state of the update process. Checks the state of any actively running update jobs or jobs that have finished in the last 30 minutes and returns the status and error state. Returns: A two-tuple where the first value is a Status enum and the second is a
()
| 15 | |
| 16 | |
| 17 | def get(): |
| 18 | """Retrieves the current state of the update process. |
| 19 | |
| 20 | Checks the state of any actively running update jobs or jobs that have |
| 21 | finished in the last 30 minutes and returns the status and error state. |
| 22 | |
| 23 | Returns: |
| 24 | A two-tuple where the first value is a Status enum and the second is a |
| 25 | string containing the error associated with a recently completed update |
| 26 | job. If the job completed successfully, the second value is None. |
| 27 | """ |
| 28 | if _is_update_process_running(): |
| 29 | return Status.IN_PROGRESS, None |
| 30 | |
| 31 | recent_result = update.result_store.read() |
| 32 | if not recent_result: |
| 33 | return Status.NOT_RUNNING, None |
| 34 | |
| 35 | return Status.DONE, recent_result.error |
| 36 | |
| 37 | |
| 38 | def _is_update_process_running(): |
nothing calls this directly
no test coverage detected