Skip to content

Commit

Permalink
add NUMBER_CONCURRENT_JOBS
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdudfield committed Jan 2, 2025
1 parent b733fae commit c13ba38
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/nwp_consumer/internal/services/consumer_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ def _parallelize_generator[T](
n_jobs: int = max(cpu_count() - 1, max_connections)
if os.getenv("CONCURRENCY", "True").capitalize() == "False":
n_jobs = 1
elif os.getenv("NUMBER_CONCURRENT_JOBS") is not None:
n_jobs = int(os.getenv("NUMBER_CONCURRENT_JOBS"))
log.debug(f"Using {n_jobs} concurrent thread(s)")

return Parallel( # type: ignore
Expand Down

2 comments on commit c13ba38

@devsjc
Copy link
Collaborator

@devsjc devsjc commented on c13ba38 Jan 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@peterdudfield Feels like this could be rolled into the one environment variable - if NUMBER_CONCURRENT_JOBS=1 then that's equivalent to CONCURRENCY=false, so both aren't needed

@peterdudfield
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea, i got rid of this in the PR. In the end just needed CONCURRENCY=false to get things working. Could adjust later on

Please sign in to comment.