Skip to content

Commit

Permalink
Make number of download threads configurable
Browse files Browse the repository at this point in the history
and reduce them to 3 by default.
  • Loading branch information
gregorjerse committed Dec 9, 2024
1 parent 22ad0fc commit f21e7d2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Changed
-------
- Catch ``EndpointConnectionError`` in retry decorator
- Implement exponential backoff in retry decorator
- Reduce the maximal number of threads for downolad data in the init container


===================
Expand Down
7 changes: 5 additions & 2 deletions resolwe/flow/executors/init_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@
DOWNLOAD_WAITING_TIMEOUT = 60 # in seconds
RETRIES = 5

# Max threads to use for data download.
MAX_DOWNLOAD_THREADS = int(os.environ.get("GENESIS_MAX_DOWNLOAD_THREADS", 3))

# Configure container logger. All logs are output to stdout for further
# processing.
# The log level defaults to debug except for boto and google loggers, which
Expand Down Expand Up @@ -112,8 +115,8 @@ async def transfer_inputs(communicator: BaseCommunicator, missing_data: dict):

try:
for connector_name in objects_to_transfer:
min_threads = 5
max_threads = 20
min_threads = 1
max_threads = MAX_DOWNLOAD_THREADS
# Use from min_threads to max_threads threads. Assume each thread
# can handle at least 100 files in reasonable time.
files_count = len(objects_to_transfer[connector_name])
Expand Down

0 comments on commit f21e7d2

Please sign in to comment.