Skip to content

Conversation

davidmrdavid
Copy link
Collaborator

Resolves: #195

This tiny PR exports the OrchestrationRuntimeStatus enum which allows for safer checks around an orchestration runtime state. This should have been done a long time ago as the runtime_status field of a DurableOrchestrationStatus object was already of OrchestrationRuntimeStatus and yet customers didn't access to the enum declaration itself.

Example:
Checking the status of an orchestration used to be as follows:

# ...
existing_instance = await client.get_status(instance_id)
my_check existing_instance._runtime_status.name == "Pending"
# ...

Whereas now users can do, and are encourage to opt for, the following:

# ...
existing_instance = await client.get_status(instance_id)
my_check existing_instance._runtime_status is df.OrchestrationRuntimeStatus.Pending
# ...

I believe this enum-based comparison is already what happens in JavaScript.

Still ToDo:

Copy link

@ConnorMcMahon ConnorMcMahon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@davidmrdavid davidmrdavid merged commit ab06df8 into dev Feb 24, 2021
@davidmrdavid davidmrdavid deleted the dajusto/check-status branch February 24, 2021 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python check status of instance behaving differently

2 participants