Skip to content

Instantly share code, notes, and snippets.

@amacal
Last active November 24, 2020 13:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amacal/4fbed44779b502c7fc9ace22992b77c9 to your computer and use it in GitHub Desktop.
Save amacal/4fbed44779b502c7fc9ace22992b77c9 to your computer and use it in GitHub Desktop.
from queue import Queue
from asyncio import get_running_loop, wait, run
from concurrent.futures import ThreadPoolExecutor
async def main():
tasks = []
loop = get_running_loop()
ftpQueue = Queue()
jsonQueue = Queue()
with ThreadPoolExecutor(max_workers=20) as executor:
for item in fetch_names():
tasks.append(loop.run_in_executor(executor, master, ..., ftpQueue, jsonQueue))
await wait(tasks)
run(main())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment