How to combine interval and calendar spec in Temporal Schedule?

Hi Temporal team,

We have use a case where we have to run workflow at times like

  • every 2 weeks on Monday, Tuesday
  • every two days.

Basically schedule value can be every # days or every # weeks on days[Sun-Sat] . I looked into schedule temporal. It seems not possible to use calendar spec alone to achieve our use case as there’s no way to specify # value directly. Wondering if this can be achieved somehow using Interval and calendar spec. Can you provide any suggestions/samples on how to achieve this?

Thanks in advance !

For the workflows created by schedule, Is there anyway to know the count of workflow that’s being executed with in that workflow? This will help us have logic written inside the workflow to skip the rest of the execution if not required.

That’s true, calendar specs currently have to be aligned only to months or days of the week.

I think you could do these with an interval spec:

Every two days is easy, just use an interval of 48 hours with an appropriate offset depending on what time of day you want it to run.

Every 2 weeks on Monday + Tuesday can be two interval specs, each with interval 14 days, one with offset 4 days plus some hours, and one with offset 5 days plus some hours. This relies on the fact that the unix epoch starts on a Thursday.

You can’t get the count but you can get the scheduled time from the TemporalScheduledStartTime search attribute within the workflow.