-
Notifications
You must be signed in to change notification settings - Fork 123
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 argo variable checking when compile to Tekton. #80
Conversation
|
||
unsupported_vars = re.findall(r"{{[^ \t\n:,;{}]+}}", workflow_dump) | ||
if unsupported_vars: | ||
logging.warning('These Argo variables are not supported in Tekton Pipeline: %s' % ", ".join(str(v) for v in set(unsupported_vars))) |
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 am assuming that if one of the Argo specific variables is not supported, then the resulting Tekton pipeline does not behave in the way the author of the Python DSL script intended it to behave. In which case I think should be a little stronger here and raise TypeError
or raise ValueError
or even raise AttributeError
. No?
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.
Let me see is there other places that rely on this. If not then I can change it to raise and exit.
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 changed to raise error now.
Hi @Tomcli, And if/when you do, are there issues tracking whether those might be in the works by the Tekton team? |
The list is basically this whole page minus the two I implemented above. A lot of these variables might not even make sense in Tekton, and most kfp pipelines try to avoid using variables that only Argo could understand. |
Some variables such as task name is already been requested in issue such as tektoncd/pipeline#2294. We can also open another issue on Tekton for this to track what variables can we support. |
I opened a related issue at Tekton tektoncd/pipeline#2322 |
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, just a tiny update on the comment wording "prompt warning" vs "raise error"
# Use regex to replace all the Argo variables to Tekton variables. | ||
# For variables that are unique to Argo, we prompt a warning to warn users on the non-supported variables. | ||
# Use regex to replace all the Argo variables to Tekton variables. For variables that are unique to Argo, | ||
# we prompt a warning to warn users on the non-supported variables. Here is the list of Argo variables. |
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.
"# we raise an Error to alert users about the unsupported
" ... :-)
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.
thanks christian.
@@ -209,7 +209,7 @@ def _create_pipeline_workflow(self, args, pipeline, op_transformers=None, pipeli | |||
|
|||
unsupported_vars = re.findall(r"{{[^ \t\n:,;{}]+}}", workflow_dump) | |||
if unsupported_vars: | |||
logging.warning('These Argo variables are not supported in Tekton Pipeline: %s' % ", ".join(str(v) for v in set(unsupported_vars))) | |||
raise ValueError('These Argo variables are not supported in Tekton Pipeline: %s' % ", ".join(str(v) for v in set(unsupported_vars))) |
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.
Great. Thanks @Tomcli !
/lgtm
/assign @animeshsingh
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: animeshsingh The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Add iris pipeline example
Which issue is resolved by this Pull Request:
Related #78
Description of your changes:
Currently this is the equivalent variable matching i found.
argo -> tekton
{{inputs.parameters.%s}} -> $(inputs.params.%s)
{{outputs.parameters.%s}} -> $(results.%s.path)
Since we don't have other equivalent matching for the rest of the argo variables, we will prompt a warning when those argo variables are used. KFP also don't recommend to use argo variables because it requires specific knowledge on Argo pipeline.
Out of all the kfp examples, only a very few of them are using Argo variables. e.g. https://github.com/kubeflow/pipelines/blob/master/samples/contrib/nvidia-resnet/pipeline/src/pipeline.py
In this case we will prompt the following warning:
The other places that use Argo variables are during artifact storing and pipeline placeholder. We could create our own tasks to avoid using Argo specific variables on these features as mentioned in #78.
Environment tested:
python --version
): 3.6.4tkn version
): 0.11kubectl version
): 1.15/etc/os-release
):