|
61 | 61 | # The skymap to use in the central repo |
62 | 62 | skymap = os.environ["SKYMAP"] |
63 | 63 | # The maximum time to spend on a single visit. |
64 | | -global_timeout = os.environ.get("WORKER_TIMEOUT", None) |
| 64 | +global_timeout = float(os.environ.get("WORKER_TIMEOUT", 0.0)) |
65 | 65 | # URI to the main repository to contain processing results |
66 | 66 | write_repo = os.environ["CENTRAL_REPO"] |
67 | 67 | # URI to the main repository containing calibs and templates |
@@ -537,14 +537,17 @@ async def _manage_process_visit(expected_visit: FannedOutVisit): |
537 | 537 | This function encapsulates the use of asyncio by process_visit, while |
538 | 538 | delegating all actual processing to `_process_visit_or_cancel`. |
539 | 539 | """ |
540 | | - try: |
541 | | - async with asyncio.timeout(global_timeout): # No timeout if None |
542 | | - await _process_visit_or_cancel(expected_visit) |
543 | | - except TimeoutError: |
544 | | - _log.error(f"Processing of group {expected_visit.group} detector {expected_visit.detector} " |
545 | | - f"failed to complete in {global_timeout} s. " |
546 | | - "Outputs have *NOT* been written.") |
547 | | - raise |
| 540 | + if global_timeout > 0.0: |
| 541 | + try: |
| 542 | + async with asyncio.timeout(global_timeout): |
| 543 | + await _process_visit_or_cancel(expected_visit) |
| 544 | + except TimeoutError: |
| 545 | + _log.error(f"Processing of group {expected_visit.group} detector {expected_visit.detector} " |
| 546 | + f"failed to complete in {global_timeout} s. " |
| 547 | + "Outputs have *NOT* been written.") |
| 548 | + raise |
| 549 | + else: |
| 550 | + await _process_visit_or_cancel(expected_visit) |
548 | 551 |
|
549 | 552 |
|
550 | 553 | async def _process_visit_or_cancel(expected_visit: FannedOutVisit): |
|
0 commit comments