Azure / Azure/azure-functions-python-worker
Graceful shutdown when using the Python worker
- Lingua principale
- Python
- Stelle
- 357
- Fork
- 116
- Merge medio
- 32m
- PR unite (30g)
- 1
Descrizione
#### Is your question related to a specific version? If so, please specify:
The question is not related to a specific version.
#### What binding does your question apply to, if any? (e.g. Blob Trigger, Event Hub Binding, etc)
HTTP trigger
#### Question
The [best practices for Azure Functions](https://learn.microsoft.com/azure/azure-functions/manage-connections?tabs=csharp#static-clients) mention that we should reuse global client instances for better performance with connection pooling. One example also demonstrates the use of [a global Cosmos client instance](https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-python?tabs=asgi%2Capplication-level&pivots=python-mode-decorators#connect-to-a-database) as a pattern.
However, with these global instances, there should be a way to close the connections on a graceful shutdown, prior to stopping the worker.
Another use-case would be to make sure that all telemetry is flushed before the host is (gracefully) shutting down.
Is there any existing documentation that I missed which would explain how to do this in Python? If not, could you provide guidance on how this should be implemented?
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia con le pagine collegate di Azure Functions sulle best practice e con le pagine di riferimento di Python, quindi esamina il ciclo di vita dell'arresto del worker per determinare se il codice Python dispone di un hook supportato per un arresto corretto. Documenta il comportamento supportato e come devono essere finalizzati i client globali o la telemetria, oppure registra la funzionalità mancante e il relativo ambito previsto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- azure, python
- Ambito
- backend, cloud
- Tipo di issue
- Documentazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 30/100