Azure / Azure/azure-functions-durable-python

create or get instance of orchestrator

オープン
#137 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る
Enhancement P3
主要言語
Python
スター
157
フォーク
70
平均マージ
2日 10時間
マージ済み PR(30日)
2

説明

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.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

まず、issue で言及されているクライアントメソッドを読みます: get_status、start_new、raise_event。複数のイベントが同じ order_id を対象とする場合に create-or-get 操作がどのように動作すべきかを定義し、そのうえで、呼び出し側が status-and-start シーケンスを実行しなくても、結果として得られたインスタンスが要求されたイベントを受け取れることを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
api, backend
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。