ActivityComplete / Skip

Hello,

Wonder what options do i have to fix this :

Imagine we have a workflow as follow :

Wordflow :

… SOME activities …

result := ExecuteActivity1
if result == true{
result2 := ExecuteActivity2
}

… SOME activities …

So activity2 is only called if activity1 results as true. if result is false, it will be skipped.

We had a bug in Activity1 that returned true by mistake. And now we have some workflows that are executing Activity2 when they shouldn’t.

A real example of the Activity2 stuck

So the bug is now fixed for new workflows, but the ones that already passed by activity1 continues to be stuck in activity2

We tried to execute the CompleteActivityByID passing all the params necessary params but we got the following error :

invalid activityID or activity already timed out or invoking workflow is completed

We are passing the 36 as activityID

Question 1 : Can we use the CompleteActivity in this scenario? What are we missing?

Question 2 : Another approach that i’m not aware if it is possible, is to “re-Execute” Activity1, so that it returns false and activity2 is skipped. Any way to do that?

Question 3 : Any other approach to handle this without failing / completing the Workflow?

Thanks for the help!

Question 1 : Can we use the CompleteActivity in this scenario? What are we missing?

CompleteActivityByID API is mainly used for asynchronous complete scenario and does not have the support to pass in retry attempt which is needed in this case to complete the activity. Filed an issue to support this.

Question 2 : Another approach that i’m not aware if it is possible, is to “re-Execute” Activity1, so that it returns false and activity2 is skipped. Any way to do that?

You can use reset command to reset your workflow execution before activity1 was scheduled. This will cause the workflow execution to re-execute activity 1 without restarting the entire workflow execution.

Thank you @samar,

I was able to reset to the workflow by the command line ( tctl ) as suggested. Haven’t found the reset command in the go SDK. Any chance it will be available?

Thanks!

It is not exposed on the high level Go SDK client by underlying service client could be used to invoke ResetWorkflowExecution API programmatically. ResetWorkflowExecution is exposed as a grpc handler on Temporal frontend and can be invoked like any other api call. Tctl also uses the same api under the covers to invoke ResetWorkflowExecution.