Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ def generate_compose(
"POSTGRES_PASSWORD": POSTGRES_PASSWORD,
"POSTGRES_DB": pg_dbs[0],
},
# postgres:17 can die mid-run (crash/OOM). Without a restart policy the
# container leaves dab-net and `dab-postgres` stops resolving for the rest
# of the trial — clinical data (e.g. PANCANCER_ATLAS) becomes unreachable
# and the agent can only abstain. Restart on failure so the populated data
# dir comes straight back up and the healthcheck recovers (mirrors dab-mongo).
"restart": "on-failure",
"healthcheck": {
"test": ["CMD-SHELL", f"pg_isready -U {POSTGRES_USER} -d {pg_dbs[0]}"],
"interval": "5s",
Expand Down
14 changes: 14 additions & 0 deletions packages/razorback-plugin-dab/tests/unit/test_compose_postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,20 @@ def test_postgres_service_emitted(tmp_path: Path):
assert "dab-net" in pg["networks"]


def test_postgres_has_restart_policy(tmp_path: Path):
# postgres:17 can die mid-run (crash/OOM). Without restart-on-failure the
# container leaves dab-net and `dab-postgres` stops resolving for the rest of
# the trial, so clinical data becomes unreachable and the agent can only
# abstain (observed on PANCANCER_ATLAS q2/q3). Mirror the dab-mongo fix.
compose_text = generate_compose(
db_config=_BOOKREVIEW_LIKE,
dataset_name="bookreview",
data_root=tmp_path,
)
pg = yaml.safe_load(compose_text)["services"]["dab-postgres"]
assert pg["restart"] == "on-failure"


def test_main_service_depends_on_postgres(tmp_path: Path):
compose_text = generate_compose(
db_config=_BOOKREVIEW_LIKE,
Expand Down