Skip to content

Commit

Permalink
Remove first-pass Docker container on second pass
Browse files Browse the repository at this point in the history
  • Loading branch information
dfsnow committed Dec 22, 2024
1 parent b0c0ab0 commit 189b540
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions data/src/utils/times.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import logging
import os
import re
import subprocess
import time
from concurrent.futures import ThreadPoolExecutor
from pathlib import Path
Expand Down Expand Up @@ -608,6 +609,13 @@ def many_to_many(self, second_pass: bool = True) -> pd.DataFrame:
# Check for completeness in the output. If any times are missing
# after the first pass, run a second pass with the fallback router
if results_df.isnull().values.any() and second_pass:
# Stop the first-pass Docker container with the goal of freeing
# the memory used by Valhalla caching
subprocess.run(
["docker", "compose", "down", "valhalla-run-fp"],
check=True,
text=True,
)
missing = results_df[results_df["duration_sec"].isnull()]
self.config.logger.info(
"Starting second pass for %s missing pairs (out of %s total)",
Expand Down

0 comments on commit 189b540

Please sign in to comment.