Trigger activity at specific time

Hi temporal folks,

I have a use-case where I want to schedule an activity and its retries at a specific time each day. I know how to configure retries every 24 hours but is it possible to configure an activity to trigger at specific time (say 8am PST) each day ?

I would use a cron workflow that executes a single activity for this.

The activity which needs to behave as a cron job is already dependent on the output of previous activities and all activities are part of the same workflow.

  • If i need to model this activity as a cron, are you suggesting to use child workflow where the child workflow is a cron workflow ?
  • Is there a way to configure an activity as cron activity ?

You have two options:

  • Invoke this activity from the same workflow in a loop. See HelloPeriodic sample.
  • Invoke it from a CRON child workflow.

Is there a way to configure an activity as cron activity ?

Not until this feature request is implemented.

1 Like

Thanks for the explanation. I’ve implemented something similar to HelloPeriodic using Workflow.sleep. It is definitely valuable, but a cron activity would be beneficial as well. Is there a backlog or other place where users can vote/+1 feature requests?

You can upvote the github issue I linked earlier.

1 Like

Slightly spinning off of this discussion - is there a plan to implement cron/absolute time scheduling for retries? The cron options for workflows, child workflows, and (eventually) activities make sense for deterministic scheduled execution, but what if I want to specify that a failed activity rerun at midnight instead of using linear/exponential backoff?

I think the best way to achieve this is to allow an activity to specify the time of the next retry explicitly.

1 Like