Skip to content

Commit b589a88

Browse files
authored
Merge pull request #320 from coderxio/jrlegrand/max-workers
Max workers 3
2 parents c6a9e0c + 243f274 commit b589a88

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

airflow/dags/sagerx.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,14 +208,16 @@ def get_api(url):
208208
def parallel_api_calls(api_calls:list) -> list:
209209
from concurrent.futures import ThreadPoolExecutor, as_completed
210210
output = []
211-
with ThreadPoolExecutor(max_workers=32) as executor:
211+
with ThreadPoolExecutor(max_workers=3) as executor:
212212
futures = {executor.submit(get_api, api_call):api_call for api_call in api_calls}
213213

214214
for future in as_completed(futures):
215215
url = futures[future]
216216
response = future.result()
217217
if not len(response) == 0:
218218
output.append({"url":url,"response":response})
219-
else:
220-
print(f"Empty response for url: {url}")
219+
if len(output) % 1000 == 0:
220+
print(f'MILESTONE {len(output)}')
221+
# else:
222+
# print(f"Empty response for url: {url}")
221223
return output

0 commit comments

Comments
 (0)