How to get the id of the run from within a component?

人走茶凉 提交于 2020-12-31 06:51:30

问题


I'm doing some experimentation with Kubeflow Pipelines and I'm interested in retrieving the run id to save along with some metadata about the pipeline execution. Is there any way I can do so from a component like a ContainerOp?


回答1:


I tried to do this using the Python's DSL but seems that isn't possible right now.

The only option that I found is to use the method that they used in this sample code. You basically declare a string containing {{workflow.uid}}. It will be replaced with the actual value during execution time.

You can also do this in order to get the pod name, it would be {{pod.name}}.




回答2:


You can use kfp.dsl.EXECUTION_ID_PLACEHOLDER and kfp.dsl.RUN_ID_PLACEHOLDER as arguments for your component. At runtime they will be replaced with the actual values.




回答3:


Your component's container will has an environment variable called HOSTNAME that is set to its unique pod name, from which you derive all necessary metadata.



来源:https://stackoverflow.com/questions/57047579/how-to-get-the-id-of-the-run-from-within-a-component

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!