dhiaayachi / temporal

Temporal service
https://docs.temporal.io
MIT License
0 stars 0 forks source link

Run workflows at sunset or sunrises #222

Open dhiaayachi opened 3 months ago

dhiaayachi commented 3 months ago

Is your feature request related to a problem? Please describe.

Would like to start a workflow at sunrise or sunset based on a GPS location provided

Describe the solution you'd like

Start a workflow with

  1. the GPS coordinates

  2. parameters like SUNSET (at sunset) SUNSET+10m (10 mins after sunset) SUNRISE-10 (10 mins before sunrise)

Describe alternatives you've considered

Looked at cron. Doesn’t seems to support this feature https://docs.temporal.io/workflows?_ga=2.197631087.1550479080.1703935511-856855575.1703935511#cron-schedules

Couldn’t find an alternative solution. If there’s please let me know

Additional context This is for IOT platform to trigger user workflows at 🌅 or 🌄

dhiaayachi commented 2 months ago

Thanks for the feature request! Temporal does not currently support Workflow starting based on sunrise or sunset.

You can use a cron expression in a Schedule to execute a Workflow at a specific time, which could be close to sunrise or sunset. You can use https://crontab.guru/ to help you determine the right time.

For example, to run a Workflow every day at 7:00 AM, you would use the cron expression 0 7 * * *. You can adjust the minute to better approximate sunrise or sunset.

We hope this workaround is helpful until sunrise/sunset functionality is available. Let us know if you have any other questions.

dhiaayachi commented 2 months ago

Thanks for your feature request! We are interested in adding the ability to start Workflows based on sunset and sunrise times.

In the meantime, you can use the Temporal CLI's schedule command with a calendar-based expression to achieve a similar result. For example, you could set a schedule to start a Workflow every day at 10 minutes after sunset. This requires you to calculate sunset times using a third-party library or service and then specify the time in the schedule command.

We hope this workaround is helpful while we work on adding this feature.