Skip to content

Commit

Permalink
Add max_worker option
Browse files Browse the repository at this point in the history
  • Loading branch information
hellais committed Jan 25, 2025
1 parent 0574fc0 commit 9fe1122
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions oonipipeline/src/oonipipeline/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class Settings(BaseSettings):
clickhouse_url: str = "clickhouse://localhost"
clickhouse_write_batch_size: int = 200_000

max_workers = int(os.cpu_count() * 0.7)

telemetry_endpoint: Optional[str] = None
prometheus_bind_address: Optional[str] = None

Expand Down
2 changes: 1 addition & 1 deletion oonipipeline/src/oonipipeline/tasks/observations.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def make_observations(params: MakeObservationsParams) -> MakeObservationsResult:
bucket_date=params.bucket_date,
)

with concurrent.futures.ProcessPoolExecutor() as executor:
with concurrent.futures.ProcessPoolExecutor(max_workers=config.max_workers) as executor:
futures = [
executor.submit(
make_observations_for_file_entry_batch,
Expand Down

0 comments on commit 9fe1122

Please sign in to comment.