Thanks to visit codestin.com
Credit goes to github.com

Skip to content

create cron-style library or wrapper for workspace autostart / autostop #817

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Tracked by #850
johnstcn opened this issue Apr 1, 2022 · 0 comments · Fixed by #844
Closed
Tracked by #850

create cron-style library or wrapper for workspace autostart / autostop #817

johnstcn opened this issue Apr 1, 2022 · 0 comments · Fixed by #844
Assignees
Labels
api Area: HTTP API
Milestone

Comments

@johnstcn
Copy link
Member

johnstcn commented Apr 1, 2022

As a user, I want to easily be able to specify a schedule for automatically starting and stopping a workspace.
The most convenient and familiar format for this is the crontab-style expression <minute> <hour> <day of month> <month> <day of week>. However, this syntax does not inlcude timezones as cronjobs are executed according to the timezone of the machine that is running them.

A simple solution is to simply append the timezone name to the cron expression e.g. 12 34 25 12 * Asia/Kolkata will specify 12:34 PM in India time (GMT+0530) on December 25th. Going to call this crontabtz for the moment.

Write a thin wrapper library that leverages existing libraries (e.g. https://github.com/robfig/cron/blob/v3/spec.go) to serialise and deserialize crontabtz expressions, supporting the following actions:

  • Parse a crontabtz expression from a string
  • Serialize a crontabtz expression to a string
  • Get the next scheduled time from the expression from a specific time
@johnstcn johnstcn added this to the Community MVP milestone Apr 1, 2022
@johnstcn johnstcn self-assigned this Apr 1, 2022
@johnstcn johnstcn added Community MVP api Area: HTTP API labels Apr 1, 2022
@misskniss misskniss modified the milestones: Community MVP, V2 Beta Apr 2, 2022
johnstcn added a commit that referenced this issue Apr 4, 2022
This is basically a small wrapper around robfig/cron/v3.

Fixes #817.
johnstcn added a commit that referenced this issue Apr 4, 2022
* feat: add crontab package for supporting autostart/stop.
This is basically a small wrapper around robfig/cron/v3.

Fixes #817.

* fixup! feat: add crontab package for supporting autostart/stop. This is basically a small wrapper around robfig/cron/v3.

* fixup! feat: add crontab package for supporting autostart/stop. This is basically a small wrapper around robfig/cron/v3.

* fixup! fixup! feat: add crontab package for supporting autostart/stop. This is basically a small wrapper around robfig/cron/v3.

* fix: return struct instead of interface

* remove unnecessary interface and export struct

* fix: doc comments

* rename package to autostart/schedule

* address PR comments
@misskniss misskniss mentioned this issue May 6, 2022
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Area: HTTP API
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants