"async_to_sync turns an awaitable into a synchronous callable, and asyncio.run executes a coroutine and return the result."
#note: maybe needs to tweak worker --pool options solo prefork gevent
ref
https://stackoverflow.com/questions/59503825/django-async-to-sync-vs-asyncio-run
just use python quart or dont use python as web services.
but if you perfer to be stuck with flask, then below could be useful:
- flask thread
https://github.com/benoitc/gunicorn/blob/master/gunicorn/config.py#L1437
-
check nodejs,npm version, upgrade if necessary.
sudo apt update
curl -sL https://deb.nodesource.com/setup_24.x | sudo bash -
sudo apt install -y nodejs
node -v
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
| """ | |
| buffer flushing logic using python asyncio Queue and Event | |
| """ | |
| import numpy as np | |
| import asyncio | |
| entire_list = [] | |
| async def flusher(queue, max_queue_size, interval, flush_event, pool): | |
| while True: |
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 time | |
| import sys | |
| import pandas as pd | |
| import numpy as np | |
| import SimpleITK as sitk | |
| def foobar_np(source_nifti_file,source_csv_file,target_nifti_file): | |
| df = pd.read_csv(source_csv_file) # columns,x,y,z,foo |
--
notes
- install k3s (quick start) https://docs.k3s.io/quick-start
| docker swarm | kubernetes |
|---|---|
| docker node ls | kubectl get nodes |
| docker stack deploy -c $YAMLFILE | kubectl apply -f $YAMLFILE |
| docker service create ... | kubectl create deploy -n $NAMESPACE $PODNAME ... |
| docker service inspect $SERVICENAME | kubectl describe pod -n $NAMESPACE $PODNAME |
NewerOlder