-
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): cronworkflows when
clause
#13474
feat(cron): cronworkflows when
clause
#13474
Conversation
f3e4011
to
ebb7225
Compare
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.
This needs documenting, with examples and the variables we can use.
I'd also like to bring across the documentation from #13365 regarding how to do the various things mentioned there but using this new technique. I'm happy to contribute that, but the basic docs need to be in here first I think.
See also the "Variables" page |
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.
Mainly reviewed the docs and examples below, but that also lends itself to some usage concerns I have about some of the variables
Hey @agilgur5 - Hope you had a good holiday weekend. I believe all of the changes you requested have been updated. I might have missed one, so please verify that. Could you remove the change request or request more changes so that we can keep moving forward on this? We'd like to roll out the |
Note: This uses the deprecated This field is intended to be deprecated and replaced with a I will create another issue to unify the logic used in the |
context, changed direction should be discussedFor context, Isitha followed up with me on Slack and I repeated my concern about using deprecated Isitha explained that he talked to Alan and decided to use I'm not necessarily opposed to using
|
Thank you for the feedback @agilgur5. It's a bit hard for me to parse through the entire comment given I haven't been following all of the discussions and am strapped for time. Could you concisely give us a couple bullet points of:
Our goal is to maintain consensus, keep our customers on mainline Argo Workflows expressions, and move quickly but thoroughly. I think working off of more concrete examples of what a Edit: Upon re-reading the comment, another interpretation would be that you're objecting to the plan of matching the implementation of |
I think it's okay to use govaluate for new feature even if it will be deprecated in the future. It's already widely adopted in the code base and the syntax is familiar to existing users. I recommend using it for this feature, work on consistency in future versions, and then provide a very detailed migration guideline to users who'd like to upgrade. This PR has been here for a month and I hope my comment breaks the tie if any and helps unblock adoption. @agilgur5 - could you let us know if this sounds good within the next two days? I'll merge it on Thursday. We can continue discuss migration path and work on consistency in a follow-up issue. |
Alan only approved it 2 weeks ago, which was shortly after I noticed the
I still have another unresolved comment as well
Neither of these are true:
Since a couple contributors and maintainers in this very thread have said that That is all the more reason to not increase inconsistency and to actually properly discuss this.
Again, these exist and they predate me, and Isitha previously expressed agreement with this in the open prior to this PR. None of the above options mention adding another |
@JPZ13 ^The above was not in the open. Isitha only wrote this after I specifically asked about it and mentioned
Otherwise, yes, this is correct. To be clear, this was not previously discussed, but I'd rather add a I think adding |
when
clause
Co-authored-by: Anton Gilgur <[email protected]> Signed-off-by: Isitha Subasinghe <[email protected]>
Co-authored-by: Anton Gilgur <[email protected]> Signed-off-by: Isitha Subasinghe <[email protected]>
Co-authored-by: Anton Gilgur <[email protected]> Signed-off-by: Isitha Subasinghe <[email protected]>
Signed-off-by: isubasinghe <[email protected]>
Signed-off-by: isubasinghe <[email protected]>
Signed-off-by: isubasinghe <[email protected]>
Signed-off-by: isubasinghe <[email protected]>
Signed-off-by: isubasinghe <[email protected]>
Signed-off-by: isubasinghe <[email protected]>
Signed-off-by: isubasinghe <[email protected]>
Signed-off-by: isubasinghe <[email protected]>
Signed-off-by: isubasinghe <[email protected]>
Signed-off-by: isubasinghe <[email protected]>
Signed-off-by: isubasinghe <[email protected]>
c02b828
to
d0b033f
Compare
Regarding
This might require a separate issue -- we should get any of these variable name consistency changes in before 3.6.0 |
@isubasinghe could this be used to run first monday of the month or last friday of the month? |
You can use arbitrary expressions, so you might be able to workaround it for #8348 with pure date/time manipulation. For instance, if you use |
You can also get the weekday it seems in expr-lang: https://expr-lang.org/docs/language-definition#date-functions Probably a little bit hacky, but dates are always at least a little bit hacky :) |
Perhaps another feature could be stored functions to help with more complex expressions, that way you could reference these stored functions instead of having to write your expressions inline. |
Issues #13474 and #12305 both introduced expressions into CronWorkflows as new features for 3.6. Motivation The expressions for `when` include the prefix `cronworkflow.`. Those for `stopStrategy.condition` do not. Unify both of these under `cronworkflow.` and allow both sets of variables to be used in both expressions. This simplifies the documentation and is less surprising. stopExpression's `condition` is mostly not a field name used, so in agreement with @agilgur5 I've renamed it to `expression`. Modifications Renamed `stopStrategy.condition` to `stopStrategy.expression` Created a single function to generate all the variables for both expressions and use that instead of the two disparate mechanisms. Modified some code comments to be godoc compliant. Verification Existing tests still pass with appropriate amendments to the test cases Note This is a breaking change vs 3.6-rc1 and rc2 for users of stopStrategy only. Signed-off-by: Alan Clucas <[email protected]>
Issues #13474 and #12305 both introduced expressions into CronWorkflows as new features for 3.6. Motivation The expressions for `when` include the prefix `cronworkflow.`. Those for `stopStrategy.condition` do not. Unify both of these under `cronworkflow.` and allow both sets of variables to be used in both expressions. This simplifies the documentation and is less surprising. stopExpression's `condition` is mostly not a field name used, so in agreement with @agilgur5 I've renamed it to `expression`. Modifications Renamed `stopStrategy.condition` to `stopStrategy.expression` Created a single function to generate all the variables for both expressions and use that instead of the two disparate mechanisms. Modified some code comments to be godoc compliant. Verification Existing tests still pass with appropriate amendments to the test cases Note This is a breaking change vs 3.6-rc1 and rc2 for users of stopStrategy only. Signed-off-by: Alan Clucas <[email protected]>
Alan and I discussed this in the Oct 1st Contributor Meeting and agreed on this. See #13702 as a follow-up |
Issues #13474 and #12305 both introduced expressions into CronWorkflows as new features for 3.6. Motivation The expressions for `when` include the prefix `cronworkflow.`. Those for `stopStrategy.condition` do not. Unify both of these under `cronworkflow.` and allow both sets of variables to be used in both expressions. This simplifies the documentation and is less surprising. stopExpression's `condition` is mostly not a field name used, so in agreement with agilgur5 I've renamed it to `expression`. Modifications Renamed `stopStrategy.condition` to `stopStrategy.expression` Created a single function to generate all the variables for both expressions and use that instead of the two disparate mechanisms. Modified some code comments to be godoc compliant. Verification Existing tests still pass with appropriate amendments to the test cases Note This is a breaking change vs 3.6-rc1 and rc2 for users of stopStrategy only. Signed-off-by: Alan Clucas <[email protected]>
Issues #13474 and #12305 both introduced expressions into CronWorkflows as new features for 3.6. Motivation The expressions for `when` include the prefix `cronworkflow.`. Those for `stopStrategy.condition` do not. Unify both of these under `cronworkflow.` and allow both sets of variables to be used in both expressions. This simplifies the documentation and is less surprising. stopExpression's `condition` is mostly not a field name used, so in agreement with agilgur5 I've renamed it to `expression`. Modifications Renamed `stopStrategy.condition` to `stopStrategy.expression` Created a single function to generate all the variables for both expressions and use that instead of the two disparate mechanisms. Modified some code comments to be godoc compliant. Verification Existing tests still pass with appropriate amendments to the test cases Note This is a breaking change vs 3.6-rc1 and rc2 for users of stopStrategy only. Signed-off-by: Alan Clucas <[email protected]>
Motivation
Modifications
This supersedes #13365 allowing for the evaluation of expr-lang expressions before running a CronWorkflow.
The scope of variables in this PR is quite limited, but can be further extended in later PRs when variable scoping is properly defined/formalised.
Verification
Added some tests for the evaluation function.