-
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
Script annotations artifacts #718
Script annotations artifacts #718
Conversation
Codecov Report
@@ Coverage Diff @@
## main #718 +/- ##
=======================================
+ Coverage 77.7% 77.9% +0.2%
=======================================
Files 45 45
Lines 3388 3472 +84
Branches 649 676 +27
=======================================
+ Hits 2633 2707 +74
- Misses 574 578 +4
- Partials 181 187 +6
... and 1 file with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
docs/examples/workflows/script_annotations_artifacts_raw_old.md
Outdated
Show resolved
Hide resolved
), | ||
] | ||
) -> str: | ||
return my_artifact |
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.
Will this return work by default if someone does not use the experimental script runner?
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.
It probably won't; I didn't really make sure the examples make sense when ran on Argo, I focused on generating the same yaml as the old version
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.
If someone's not using the runner then I think this would return an empty string? Not using the runner with Artifact annotations seems to be the wrong thing to be doing
Signed-off-by: Mikolaj Deja <mdeja2@bloomberg.net>
Move parameter examples to tests Signed-off-by: Mikolaj Deja <mdeja2@bloomberg.net>
b1c3028
to
3fcf7cb
Compare
Signed-off-by: Mikolaj Deja <mdeja2@bloomberg.net>
Signed-off-by: Mikolaj Deja <mdeja2@bloomberg.net>
Signed-off-by: Mikolaj Deja <mdeja2@bloomberg.net>
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.
Wooo! 🚀
Pull Request Checklist
Description of PR
In Hera we are able to specify
Artifact
s ininputs
:But by using annotations we can avoid repeating the
path
of the file, and access the artifact as if it's a regular Python argument of the given type:The path duplication is no longer necessary since
an_artifact
is aPath
object.The fields allowed in the
Artifact
annotations are:name
,path
, andloader
.For
Artifact
s, we allow three types of loaders. UsingArtifactLoader
, we havefile
,json
,and
None
.With no loader, the
path
attribute ofArtifact
is extracted and can be subsequently used in the function body by referring to the function parameter. This can be seen above.When the loader is set to
file
, the function parameter will be the contents of the filestored at
path
.This loads the contents of the file at
ARTIFACT_PATH
to the argumentan_artifact
and subsequently can be used as a string inside the function.When the loader is set to
json
, the contents of the file atpath
are read and parsed tojson
.Here, we have a json representation of
MyArtifact
stored atARTIFACT_PATH
. We can load it withArtifactLoader.json
and then usean_artifact
as an instance ofMyArtifact
inside the function.