You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
func SampleParentWorkflow(ctx workflow.Context) error {
logger := workflow.GetLogger(ctx)
execution := workflow.GetInfo(ctx).WorkflowExecution
// Parent workflow can choose to specify it's own ID for child execution. Make sure they are unique for each execution.
childID := fmt.Sprintf("child_workflow:%v", execution.RunID)
cwo := workflow.ChildWorkflowOptions{
// Do not specify WorkflowID if you want cadence to generate a unique ID for child execution
WorkflowID: childID,
ExecutionStartToCloseTimeout: time.Minute,
}
ctx = workflow.WithChildOptions(ctx, cwo)
var result string
workflow.ExecuteChildWorkflow(ctx, SampleChildWorkflow, 0, 5)
workflow.Sleep(ctx, time.Second)
f := workflow.ExecuteChildWorkflow(ctx, SampleChildWorkflow, 0, 5)
f.GetChildWorkflowExecution().Get(ctx, nil)
err := f.Get(ctx, &result)
if err != nil {
logger.Error("Parent execution received child execution failure.", zap.Error(err))
return err
}
logger.Info("Parent execution completed.", zap.String("Result", result))
return nil
}
The text was updated successfully, but these errors were encountered:
ExecuteChildWorkflow(...).GetChildWorkflowExecution(..).Get(...) panics if the child workflow with the same ID is already running:
Here is the code to reproduce:
The text was updated successfully, but these errors were encountered: