Azure / Azure/azure-functions-durable-python

create or get instance of orchestrator

Abierto
#137 2 comentarios 0 reacciones 0 asignados Ver en GitHub
Enhancement P3
Lenguaje dominante
Python
Estrellas
157
Forks
70
Merge medio
2 d 10 h
PR fusionados (30 d)
2

Descripción

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.

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Empiece por leer los métodos del cliente mencionados en el issue: get_status, start_new y raise_event. Defina cómo debe comportarse una operación de creación u obtención cuando varios eventos tienen como objetivo el mismo order_id y, después, verifique que la instancia resultante pueda recibir el evento solicitado sin que el llamador tenga que ejecutar la secuencia status-and-start.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
api, backend
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.