Closed zhujiangyou closed 4 years ago
Hey @zhujiangyou, thanks for the question!
I'll try to clarify the purpose of this client and see if I answer your question.
This library currently doesn't have the Argo CLI ported to Python, if that's what you mean. I am sorry to disappoint you if that's what you have expected.
This client acts similarly to the kubernetes-python-client. It is basically an extension to the Kubernetes client providing Argo models and API paths to create, list, delete and in general manipulate workflows and workflow templates as you would do with any other Kubernetes resource.
@CermakM just wanted to let you know what you have done is very valuable to me. I didn't make much progress on this after I tried to generate python sdk from argo swag definition (with Kubernetes client generator). I were able to generate the models but I couldn't fix the dependency problems where some Argo models just assume kubernetes models were there. So would love to know how you have resolved that.
Other than that it's been great, I have been able to build dags on top of your sdk and on my way to work a workflow framework on top of your client. Thank you!
Hey @yxue-kabam. Thanks a lot for the feedback! :) I am glad it helps!
Yep, it's been somewhat complicated to include the kubernetes models. I solved it by tweaking the code generation and including the Python Kubernetes models.
The SDK is currently under development: https://github.com/CermakM/argo-python-sdk
Here is a hello-world example of the Argo Python SDK. Feel free to visit https://github.com/CermakM/argo-python-sdk for more examples.
Argo YAML | Argo Python |
---|---|
```yaml # @file: hello-world.yaml apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: name: hello-world generateName: hello-world- spec: entrypoint: whalesay templates: - name: whalesay container: name: whalesay image: docker/whalesay:latest command: [cowsay] args: ["hello world"] ``` |
```python from argo.workflows.sdk import Workflow from argo.workflows.sdk import template from argo.workflows.sdk.templates import V1Container class HelloWorld(Workflow): entrypoint = "whalesay" @template def whalesay(self) -> V1Container: container = V1Container( image="docker/whalesay:latest", name="whalesay", command=["cowsay"], args=["hello world"] ) return container ``` |
If you want an API for Argo CLI directly, please check https://github.com/argoproj-labs/argo-workflows-python-sdk
Where can I find a python SDK to replace Argo's various command-line interfaces?