-
Notifications
You must be signed in to change notification settings - Fork 106
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
Add CronWorkflow.update, add unit tests #681
Add CronWorkflow.update, add unit tests #681
Conversation
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 stuff, thank you @iameskild! 🚀
Hey @iameskild - you'll need to rebase and push with signoff to pass the DCO check. You can run these to fix it:
|
Codecov Report
@@ Coverage Diff @@
## main #681 +/- ##
=====================================
Coverage 76.1% 76.2%
=====================================
Files 45 45
Lines 3088 3105 +17
Branches 584 584
=====================================
+ Hits 2352 2368 +16
- Misses 566 567 +1
Partials 170 170
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Signed-off-by: iameskild <eskild.eriksen122@gmail.com>
8ade723
to
163fe27
Compare
Thanks @elliotgunton! Added my sign-off to the commit :) |
**Pull Request Checklist** - [x] Fixes #<!--issue number goes here--> - [x] Tests added - [ ] Documentation/examples added - [x] [Good commit messages](https://cbea.ms/git-commit/) and/or PR title **Description of PR** In my previous PR #681, I'm using the wrong parameter when calling `UpdateCronWorkflowRequest`; it should've been `cron_workflow` and not `template`. To validate that this change is needed, I used this simple example. Without the fix from this PR, you will likely receive the following error message: ``` hera.exceptions.InternalServerError: Server returned status code 500 with message: `runtime error: invalid memory address or nil pointer dereference` ``` <details> ```py import time from hera.workflows import CronWorkflow, Container # authenticate w Argo Server global_config = authenticate() with CronWorkflow( name="my-cw", namespace=global_config.namespace, schedule="*/1 * * * *", entrypoint="main", ) as cw: cmd_args = ["-c", "echo 'hello world'"] main = Container( name="main", command=["/bin/sh"], args=cmd_args, ) pass cw.create() time.sleep(10) with CronWorkflow( name="my-cw", namespace=global_config.namespace, schedule="2 * * * *", # new schedule entrypoint="main", ) as ncw: cmd_args = ["-c", "echo 'hello world'"] main = Container( name="main", command=["/bin/sh"], args=cmd_args, ) ncw.update() ``` </details> Signed-off-by: iameskild <eskild.eriksen122@gmail.com>
Pull Request Checklist
Description of PR
Include methods (
update
andget
) to theCronWorkflow
object - to matchWorkflowTemplate
.cc @elliotgunton