Cron Jobs with Child Workflows

Hello,

I am writing a workflow that starts a series of child workflows on cron schedules. Here is my pseudo code for the parent workflow:

	var futures []workflow.ChildWorkflowFuture
	for _, config := configs {
		childWorkflowOptions := workflow.ChildWorkflowOptions{
			CronSchedule: config.Crontab,
		}
		ctx = workflow.WithChildOptions(ctx, childWorkflowOptions)
                someWorkflowInput := inputs.SomeWorkflowInput{}
		future := workflow.ExecuteChildWorkflow(
			ctx,
			SomeWorkflow,
			someWorkflowInput
		)
		futures = append(futures, future)
	}

	for _, future := range futures {
		someWorkflowResponse := responses.SomeWorkflowResponse{}
		err := future.Get(ctx, someWorkflowResponse)
		if err != nil {
			return err
		}
	}
       // possibly more code

I know that when the ExecuteChildWorkflow function runs, it will spawn an execution that is backed off by a cron offset, and continue with execution in the main thread. Then, at .Get, execution will block until the child execution finishes, which will be never, as once a run finishes another one is started in the cron job.

So, theoretically, no code below the .Get line will ever be executed.

I have a few questions about this:

  1. Is this the conventional way of “blocking endlessly” so the crons can run forever, seeing as the results are never actually used? Or would it make more sense to just have a simple while loop or something?
  2. There is no way to retrieve the results of each individual run in the calling code here, correct?
  3. If an individual run fails, the next run in the cron schedule will still be scheduled, correct? The first run just has to terminate somehow, whether it be successful, failed, or timed out?

Thanks

Hello,

Just bumping this. I’ve done some more looking, and need to make a few changes to the post:

Then, at .Get , execution will block until the child execution finishes

This should be “child execution chain”

  1. There is no way to retrieve the results of each individual run in the calling code here, correct?

I believe this is actually incorrect, and want to confirm this can be done with the use of signals?

Thanks!