-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
feat(cron): allow multiple schedules
#12616
feat(cron): allow multiple schedules
#12616
Conversation
Signed-off-by: eduardodbr <eduardodbr@hotmail.com>
Signed-off-by: eduardodbr <eduardodbr@hotmail.com>
Signed-off-by: eduardodbr <eduardodbr@hotmail.com>
Signed-off-by: eduardodbr <eduardodbr@hotmail.com>
Signed-off-by: eduardodbr <eduardodbr@hotmail.com>
Signed-off-by: eduardodbr <eduardodbr@hotmail.com>
CI is failing because of #12596 |
Signed-off-by: eduardodbr <eduardodbr@hotmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
Signed-off-by: eduardodbr <eduardodbr@hotmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM once conflicts are resolved
Signed-off-by: eduardodbr <eduardodbr@hotmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NOTE: this is my first time ever doing react /typescript it is expected that the code lacks quality. Please suggest changes.
This seems to have not gotten a UI SME before merge. It's mostly good, but I left a few comments on improvements below. In particular, the possible unnecessary new line when schedules
contains only a single schedule is something to check
<> | ||
<PrettySchedule schedule={schedule} /> | ||
<br /> | ||
</> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure that most of these instances can be simplified with a <p>
paragraph element instead of a <>
fragment + a <br />
line break
<> | |
<PrettySchedule schedule={schedule} /> | |
<br /> | |
</> | |
<p><PrettySchedule schedule={schedule} /></p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also how does this look when schedules
only contains a single schedule? It seems like there may be an unnecessary new line in that case since it is currently treated differently from schedule
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm we use <p>
elements in the new markdown title & description feature. Might need to add similar CSS here (line-height
, display
, and vertical-align
). That and it might not work properly if one column uses <p>
while the other uses <br />
.
Try that; if it doesn't work, I can take a look on my side
ui/src/app/cron-workflows/components/cron-workflow-list/cron-workflow-list.tsx
Show resolved
Hide resolved
<> | ||
{schedule} | ||
<br /> | ||
</> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<> | |
{schedule} | |
<br /> | |
</> | |
<p>{schedule}</p> |
same as above
<> | ||
<code>{schedule}</code> <PrettySchedule schedule={schedule} /> | ||
<br /> | ||
</> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<> | |
<code>{schedule}</code> <PrettySchedule schedule={schedule} /> | |
<br /> | |
</> | |
<p><code>{schedule}</code> <PrettySchedule schedule={schedule} /><p/> |
same as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also clients (CLI and UI) should probably have updated labels: Schedule
-> Schedules
.
ui/src/app/cron-workflows/components/cron-workflow-list/cron-workflow-list.tsx
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CronWorkflow
s docs also need updating around multiple schedules, with version specifiers (see #12581 for examples)
schedules
Fixes: #12493
Fixes: #9734
Motivation
This PR introduces a new CronWorkflow spec field
Schedules
, a list of cron schedules for a workflow to execute. It maintains backward compatibility withSpec.Schedule
and adds a validation that ensures that both fields cannot be configured simultaneously.Modifications
Controller
1 - This implementation tries to maintain the same behavior for the controller and operator. This biggest change was made to the
cronFacade
where a key can hold multiple cron entries instead of only one. This involved changing the signature for the methodLoad
to return an array of cronWfOperationCtx since a key can hold multiple entries:This method doesn't seem to be used anywhere and cronFacede is not exposed so I don't think there is any issue with this change. Let me know if you think otherwise.
2 - The controller is currently using the label
cronworkflows.argoproj.io/last-used-schedule
to store the current cron expression. This label is only used to check whether the cron expression has been updated since the last time the WF ran, so this PR changes it to be a comma-separated list of the schedules (if applicable). Whenever any of the schedules is updated the label will be changed.Possible Issues
If two cron expressions overlap (for example the expressions
*/2 * * * *
and*/3 * * * *
will overlap at minute 6,12,18,etc) only one WF will be executed because the second will be seen as a duplicate submission. I don't think there is an issue with this, but let me know if you think otherwise. This makes it a bit harder to create an E2E test that is deterministic. Because of that, I decided to not add an E2E test for this feature.CLI
argo cron list
was updated to show all schedules:argo cron get
was updated:UI
NOTE: this is my first time ever doing react /typescript it is expected that the code lacks quality. Please suggest changes.
Cron Workflow list was updated to show all schedules:
Cron Workflow status viewer was also updated:
Cron Spec editor:
Verification
This change can be tested with the following cron workflow: