-
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
[#595] Improve artifact/parameter access #639
Conversation
Signed-off-by: Flaviu Vadan <flaviuvadan@gmail.com>
Signed-off-by: Flaviu Vadan <flaviuvadan@gmail.com>
Signed-off-by: Flaviu Vadan <flaviuvadan@gmail.com>
Codecov Report
@@ Coverage Diff @@
## main #639 +/- ##
=====================================
Coverage 72.5% 72.5%
=====================================
Files 43 43
Lines 2983 2973 -10
Branches 572 568 -4
=====================================
- Hits 2163 2158 -5
+ Misses 668 663 -5
Partials 152 152
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Signed-off-by: Flaviu Vadan <flaviuvadan@gmail.com>
Signed-off-by: Flaviu Vadan <flaviuvadan@gmail.com>
Signed-off-by: Flaviu Vadan <flaviuvadan@gmail.com>
if isinstance(self.template, Templatable): | ||
template = self.template._build_template() | ||
else: | ||
template = self.template |
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.
A general point here - we've been finding it hard to work with TemplateRefs that we know output certain parameters, so we might want to relax/change this validation. Something we'll look to address in a later PR, JFYI
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 see. Do you imagine this can actually accommodate template refs by actually fetching the template based on the ref if self.template is a string, and search the params like that?
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.
fetching the template
This would be pretty awesome, and along the lines of what we're thinking - if we're able to statically generate stubs from a given WorkflowTemplate, so that we have a class that inherits from a Hera TemplateRef
and works with our functions like get_parameter
.
class TemplateRef(IOMixin):
pass # let's say we've implemented this
from hera.workflow import TemplateRef
class MyTemplateRefStub(TemplateRef): # we generate this in some hera.workflow.template_ref_stubs module or something
inputs = [Parameter("a-parameter", default="some-default")]
outputs = [Parameter("an-output-parameter")]
... etc
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.
Really like the changes! I saw that we can reduce duplication a bit more - see #644 and feel free to merge it in
Small PR on top of a WIP to avoid making suggestions/commits --------- Signed-off-by: Elliot Gunton <egunton@bloomberg.net>
# Conflicts: # scripts/service.py # src/hera/events/service.py # src/hera/exceptions/__init__.py # src/hera/workflows/service.py
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
Pull Request Checklist
Description of PR
@elliotgunton and I bounced some thoughts on improving access to parameters/artifact via #595 and #613. This PR adds the implementation @elliotgunton suggested to the template invokator class. Open to having these on a different mixin!