-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Orchestration ID reuse policies #42
Comments
My vote for having the extra ID to be able to identify different runs of the workflow in logs. |
Would it be reasonable to add a hint of : An example, scenarios where workflows are being started via queue with at-least-once guarantees (which is quite common) it would be useful to have this hint because :
Unless I'm mistaken, It's my understanding that none of the 3 new reuse policies would accommodate the above scenario? |
The The original definition of |
Yes this is why I'm proposing an additional policy, so that it doesn't interfere with the needs of your use-case (which I think is |
So you are suggesting that one combines, for example, As a way to differentiate what to do if it is just scheduled vs already running? |
I am assuming this doesn't have much meaning for |
This is how I interpret the current proposal :
Assuming my interpretation above is correct, I would like to see the following policy added
|
Thanks @olitomlinson for the explanation on |
Catching up on this discussion. If I understand the proposal from @olitomlinson, the problem you're trying to solve is that you want to only reuse the orchestration ID if an existing instance is in a failed state. I think that makes sense. Would it just be "failed", or could it also include "Terminated" (and perhaps some future "Canceled" state)? |
Wouldn't it be easier just to say It appears to only be a rule for when the workflow is in a failed state. |
@cgillum I agree, it should be Although I think going down this path is going to lead to a trying to support a huge set of highly specific, Policies which isn't sustainable. Suggestion Divorce the ACTION (
WorkflowOptions {
ReusePolicy = new ReusePolicy(action: Action.Terminate, states: new[]{ State.All })
}
WorkflowOptions {
ReusePolicy = new ReusePolicy(action: Action.Skip, states: new[]{ State.Running, State.Complete, State.Paused, State.Terminated})
} |
I'd recommend using enum flags for the states field. |
I'm in agreement with the more fine-grained policy. It introduces more conceptual complexity, IMO, but it's more flexible, precise, and better aligned with existing APIs in the .NET version of the Durable Task Framework. |
I've never used Enum Flags so no first hand experience, but they look great for this use-case! |
When rethinking this proposal, I found there are some cases that are not quite clear. For ex:
For this option, we are creating a new instance with action |
First thoughts, the first two seem straight forward :
However I'm stuck on this one...
|
If we think of the second condition as a "when/where" clause then perhaps we can simplify things a bit and just eliminate the "skip" condition since that could be the default for the other two if the predicate isn't matched. Or some variation on that. |
The "variation on that" could be that we keep the "throw" as the default path as it is today. |
Does this pseudocode seem like the right behavior? ok = not exists
if exists:
if skip and status_matches:
# log a warning
ok = True
if terminate and status_matches:
# terminate the instance
ok = True
if not ok:
# throw
if not skip:
# create the instance |
I think it should be if not exists:
# create instance
else:
ok = false
if skip and status_matches:
# log a warning
ok = True
if terminate and status_matches:
# terminate the instance
ok = True
if not ok:
# throw
if not skip:
# create instance The reason is that when customer create a instance using Another thing to point out for the above pseudocode (Chris's as well) is that if the customer chooses the action THROW then no matter what statuses they set, it will always Throw if an instance already exists. I just want to make sure this is what we want. |
Yeah, it looks like my And I see your point about |
Is this related to supporting a start-with-signal pattern, or is that a separate concern? start-with-signal will send an event to a specific workflow instance and make sure that instance is running. In that order, to avoid a race. If the reuse policy can be attached to a specific start request, then I imagine this pattern could be implemented in two separate requests (signal + start) as I described. |
This idea comes from dapr/dapr#7101, as it relates to reusing existing workflow IDs.
When scheduling the creation of a new orchestration, the following options should be available:
TerminateIfExists
- Terminates any existing orchestrations with the same instance ID and then schedules a new instance as one atomic action, similar to on-demand ContinueAsNew.SkipIfExists
- If there is an existing orchestration already scheduled, then the scheduler does nothing.ThrowIfExists
- If there is an existing orchestration then the scheduler throws an exception (this is the current behavior).As an optional extension of this, we can consider exposing an "Execution ID" or "Generation ID" property to the orchestration which can help distinguish different instantiations of the given instance ID.
The text was updated successfully, but these errors were encountered: