diff --git a/CHANGELOG.md b/CHANGELOG.md index a1df36ce..5deecb80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ The format is roughly based on [Keep a Changelog](https://keepachangelog.com/en/ - Dockerfile: switch to `python:3.9-slim-bullseye` base image - Parallelize `/jobs` requests to upstream back-ends ([#28](https://github.com/Open-EO/openeo-aggregator/issues/28)) +- Increase timeout on getting batch job logs to 120s ([#128](https://github.com/Open-EO/openeo-aggregator/issues/128)) ### Fixed diff --git a/src/openeo_aggregator/backend.py b/src/openeo_aggregator/backend.py index 7f405d7e..7b02a50d 100644 --- a/src/openeo_aggregator/backend.py +++ b/src/openeo_aggregator/backend.py @@ -62,6 +62,7 @@ import openeo_aggregator.egi from openeo_aggregator.caching import Memoizer, json_serde, memoizer_from_config from openeo_aggregator.config import ( + CONNECTION_TIMEOUT_JOB_LOGS, CONNECTION_TIMEOUT_JOB_START, CONNECTION_TIMEOUT_RESULT, AggregatorConfig, @@ -888,8 +889,11 @@ def get_log_entries( level: Optional[str] = None, ) -> Iterable[dict]: con, backend_job_id = self._get_connection_and_backend_job_id(aggregator_job_id=job_id) + # Use parenthesized context managers, see #127 with con.authenticated_from_request(request=flask.request, user=User(user_id)), \ - self._translate_job_errors(job_id=job_id): + self._translate_job_errors(job_id=job_id), \ + con.override(default_timeout=CONNECTION_TIMEOUT_JOB_LOGS), \ + TimingLogger(title=f"Get log entries for {job_id}", logger=_log.debug): return con.job(backend_job_id).logs(offset=offset, level=level) diff --git a/src/openeo_aggregator/config.py b/src/openeo_aggregator/config.py index f6b0d1d1..2a5e5ea9 100644 --- a/src/openeo_aggregator/config.py +++ b/src/openeo_aggregator/config.py @@ -18,6 +18,7 @@ CONNECTION_TIMEOUT_INIT = 12.5 CONNECTION_TIMEOUT_RESULT = 15 * 60 CONNECTION_TIMEOUT_JOB_START = 5 * 60 +CONNECTION_TIMEOUT_JOB_LOGS = 2 * 60 STREAM_CHUNK_SIZE_DEFAULT = 10 * 1024