Skip to content

Commit 5d1dbf9

Browse files
update max_tasks
1 parent d59a699 commit 5d1dbf9

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

apps/bfd-pipeline-idr/src/idr_pipeline/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from .pipeline_stages import StagedIdrPipeline
2828
from .settings import (
2929
INCREMENTAL_IDR_JOB_GRACE_PERIOD,
30-
MAX_TASKS,
30+
max_tasks,
3131
TABLES_TO_LOAD,
3232
bfd_test_date,
3333
)
@@ -124,7 +124,7 @@ def run(source: Source, load_mode: LoadMode, load_type: LoadType, job_id: int =
124124
atexit.register(worker_manager.cleanup)
125125

126126
staged_pipeline = StagedIdrPipeline(
127-
max_workers=MAX_TASKS,
127+
max_workers=max_tasks(),
128128
load_mode=load_mode,
129129
start_time=start_time,
130130
load_type=load_type,

apps/bfd-pipeline-idr/src/idr_pipeline/settings.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ def enable_prior_auth_ingestion() -> bool:
7272
This is useful if you've already loaded some data and you do not want to reprocess
7373
any batches that have already completed before this date."""
7474

75-
MAX_TASKS = int(getenv("IDR_MAX_TASKS", "32"))
75+
def max_tasks() -> int:
76+
return int(getenv("IDR_MAX_TASKS", "32"))
77+
7678
"""Maximum concurrent tasks to run.
7779
Changing this has a drastic effect on the runtime.
7880
In prod, we want to run as many tasks as possible without running out of memory."""

apps/bfd-pipeline-idr/test/test_pipeline.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,7 @@ def _setup_pipeline_environment(info: psycopg.ConnectionInfo) -> None:
786786
os.environ["IDR_PER_BATCH_MIN_CONNECTIONS"] = "1"
787787
os.environ["IDR_PER_BATCH_MAX_CONNECTIONS"] = "1"
788788
os.environ["IDR_ENABLE_PRIOR_AUTH"] = "1"
789+
os.environ["IDR_MAX_TASKS"] = "4"
789790

790791

791792
@pytest.fixture(scope="module")

0 commit comments

Comments
 (0)