This file contains hidden or 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
| #!/usr/bin/env python3 | |
| # Combining coroutines running in an asyncio event loop with | |
| # blocking tasks in thread pool and process pool executors. | |
| # | |
| # Based on https://pymotw.com/3/asyncio/executors.html, but this version runs both | |
| # threads and processes at the same time and interleaves them with asyncio coroutines. | |
| # | |
| # All appears to be working. | |
| # |
This file contains hidden or 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 logging | |
| import logging.handlers | |
| stream_handler = logging.StreamHandler() | |
| stream_handler.setLevel(logging.INFO) | |
| file_handler = logging.FileHandler(f"{os.getcwd()}/my_log.log") | |
| logging.basicConfig( |
This file contains hidden or 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
| { | |
| "cable:length_unit": [ | |
| { | |
| "value": "m", | |
| "label": "Meters" | |
| }, | |
| { | |
| "value": "cm", | |
| "label": "Centimeters" | |
| }, |
This file contains hidden or 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
| credentials.py | |
| __pycache__/ | |
| *.py[cod] | |
| *venv/ | |
| *.venv/ | |
| *.crt | |
| *.key | |
| *.env | |
| *.log | |
| *.retry |
This file contains hidden or 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
| from multiprocessing import Pool | |
| RESULTS = [] | |
| CALLBACK_DATA = [] | |
| def mycallback(x): | |
| print('mycallback is called with {}'.format(x)) | |
| CALLBACK_DATA.append(x) | |
| def multiply_by_two(x): |