This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async def run_tasks_concurrently(fn, input_params, *, max_concurrency): | |
input_params_iter = iter(input_params) | |
# total_tasks = len(input_params) | |
total_completed_tasks = 0 | |
results = [] | |
tasks = {asyncio.create_task(fn(param)) for param in itertools.islice(input_params_iter, max_concurrency)} | |
while tasks: | |
finished, tasks = await asyncio.wait(tasks, return_when=asyncio.FIRST_COMPLETED) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import time | |
import csv | |
from concurrent.futures import ThreadPoolExecutor, wait | |
import boto3 | |
dynamo_client = boto3.resource("dynamodb").meta.client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[tox] | |
envlist = lint,py3{6,8,9} | |
skip_missing_interpreters = true | |
[testenv] | |
deps = | |
-r requirements/test.txt | |
py36: -r requirements/py36.txt | |
commands = | |
pytest {posargs:tests} |