Closed brtasavpatel closed 4 years ago
Hi, can you uninstall argo-models
and install argo-client-python ?
pip install -U git+git://github.com/CermakM/argo-client-python.git
What I have is different than yours:
argo-workflows 3.0.0rc0
argo-workflows-dsl 0.1.0.dev0
I am not sure what is argo-models
project though.
here is the code successfully submit the hello-world example for me.
from argo.workflows.client import V1alpha1Api
from argo.workflows.config import load_kube_config
from argo.workflows.dsl import Workflow
from argo.workflows.dsl import template
from argo.workflows.dsl.templates import V1Container
from argo.workflows.config import load_kube_config
load_kube_config()
api = V1alpha1Api()
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
wf = HelloWorld()
print(wf)
result = api.create_namespaced_workflow('argo', wf)
print(result.metadata.name)
how did you install argo-workflows-dsl
though? I cloned master
branch and did python setup.py install
is that the correct way to install?
I cannot speak for the author whether this is the correct way, seeing both libraries is under active development (especially this one), I'd expect a better installation process in the future.
What I did to get it working: (should not be a reliable way)
start a new virtual env,
pip install -U git+git://github.com/CermakM/argo-client-python.git
pip install -U git+git://github.com/CermakM/argo-python-dsl.git
@yxue-kabam That is exactly right and thanks for the active participation.
The client library has already been released to PyPI: https://pypi.org/project/argo-workflows/,
so it can be installed directly as pip install -U argo-workflows
.
The DSL, however, is indeed under active development and it is currently 'safer' to install it from github directly.
@brtasavpatel does the problem with the import persist? As far as the other issue is concerned, I commented right there :)
PS: argo-models
are not my doing and are not related to this library
thanks @yxue-kabam and @CermakM for the replies, I think because of that argo-models
package I had some module name conflicts that's why it wasn't working,
code snippet above works, though there's one issue with that (I don't know if it's intentional) when I try to submit same workflow twice I get
ApiException: (500)
Reason: Internal Server Error
HTTP response headers: HTTPHeaderDict({'Content-Type': 'application/json', 'Date': 'Wed, 26 Feb 2020 22:32:48 GMT', 'Content-Length': '286'})
HTTP response body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"The POST operation against Workflow.argoproj.io could not be completed at this time, please try again.","reason":"ServerTimeout","details":{"name":"POST","group":"argoproj.io","kind":"Workflow"},"code":500}
Here this exception is totally misleading. I have investigated and found out that it's failing because argo doesn't allow same names for the workflows. if I set workflow name to empty string like this : wf.name = ''
I can submit the workflow multiple times.
I wanted to know Is this an intended behavior?
sorry guys to bombard you all with questions, I have one more question. how can I specify which Service Account to use when I submit a workflow? for eg with argo cli I can do
argo submit --serviceaccount my-serviceaccount --watch https://raw.githubusercontent.com/argoproj/argo/master/examples/hello-world.yaml
how can I specify service account? either in dsl
or create_namespaced_workflow
?
sorry guys to bombard you all with questions, I have one more question. how can I specify which Service Account to use when I submit a workflow? for eg with argo cli I can do
argo submit --serviceaccount my-serviceaccount --watch https://raw.githubusercontent.com/argoproj/argo/master/examples/hello-world.yaml
how can I specify service account? either in
dsl
orcreate_namespaced_workflow
?
if anyone else is wondering about this one. I got it to work using @CermakM 's help.
here's how you can do that, specify service_account_name
in Workflow class.
class HelloWorld(Workflow):
entrypoint = "whalesay"
service_account_name = "argo-workflow"
@template
def whalesay(self):
container = V1Container(
image="docker/whalesay:latest",
name="whalesay",
command=["cowsay"],
args=["hello world"]
)
return container
again thanks a lot @CermakM for great work. :-)
Describe the bug I am on
master
branch and tried following simpleHelloWorld
example. when I try tofrom argo.workflows.dsl import Workflow
I getPython Version :
Python 3.7.5
Installed
argo-workflows
usingpip install -e "git+git://github.com/CermakM/argo-client-python@argo/v2.5.0#egg=argo-workflows"
To Reproduce Steps to reproduce the behavior:
master
branch code.Screenshots