Azure / Azure/azure-functions-durable-python

create or get instance of orchestrator

Aperta
#137 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Enhancement P3
Lingua principale
Python
Stelle
157
Fork
70
Merge medio
2g 10h
PR unite (30g)
2

Descrizione

I was creating a orchestration that was waiting for three events (from EventGrid) and then calls another two activities and got it working, but noticed that my code is needlessly complex, this is what happens in my trigger (with EventHubTrigger), after creating a blob object with a order_id attribute, I need this code:
```python
try:
status = await client.get_status(blob.order_id)
instance_id = status.instance_id
except Exception:
instance_id = await client.start_new("Orchestrator", blob.order_id, None)
if instance_id:
await client.raise_event(instance_id, blob.file_type, True)
else:
logging.error("Could not start orchestrator for instance: %s", blob.order_id)
```

I would expect either the `client.start_new` call to either create a new one or get an existing one, or for there to be a something like a `get_or_start_new` function on client.

The reason I needed to do it like this is that I have a single input (EventGrid triggered by storage) and need to both start a orchestration and raise an event, I do have an instance_id I can use to align the different events to the same orchestrator instance but the fact that I can't just have this function call `start_new` three times is very unintuitive and hard to debug.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Iniziate leggendo i metodi del client menzionati nell’issue: get_status, start_new e raise_event. Definite come dovrebbe comportarsi un’operazione di creazione o recupero quando più eventi hanno come destinazione lo stesso order_id, quindi verificate che l’istanza risultante possa ricevere l’evento richiesto senza che il chiamante debba eseguire la sequenza status-and-start.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
api, backend
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.