Example fails - ValueError: Invalid value for `name`, must not be `None`
Hi.
I've trying to rewrite a shell-script into a Python script and get a bit better control over the interactions with Argo. This library looks like just what the doctor ordered.
However, when I try to submit the example it fail. I use the hello world example workflow. It fails deep inside the k8s libs, in the v1_container apis where a name for the container seems to be required.
The whole stack trace is here:
✗ python submit.py
Argo seems to work....
Got the manifest.
Traceback (most recent call last):
File "submit.py", line 24, in <module>
api.create_namespaced_workflow(namespace, manifest)
File "/Users/perbu/Library/Caches/pypoetry/virtualenvs/argo-kicker-cI2Nxebk-py3.7/lib/python3.7/site-packages/argo/workflows/client/api/v1alpha1_api.py", line 311, in create_namespaced_workflow
return self.create_namespaced_workflow_with_http_info(namespace, body, **kwargs) # noqa: E501
File "/Users/perbu/Library/Caches/pypoetry/virtualenvs/argo-kicker-cI2Nxebk-py3.7/lib/python3.7/site-packages/argo/workflows/client/api/v1alpha1_api.py", line 408, in create_namespaced_workflow_with_http_info
collection_formats=collection_formats)
File "/Users/perbu/Library/Caches/pypoetry/virtualenvs/argo-kicker-cI2Nxebk-py3.7/lib/python3.7/site-packages/argo/workflows/client/api_client.py", line 353, in call_api
_preload_content, _request_timeout, _host)
File "/Users/perbu/Library/Caches/pypoetry/virtualenvs/argo-kicker-cI2Nxebk-py3.7/lib/python3.7/site-packages/argo/workflows/client/api_client.py", line 192, in __call_api
return_data = self.deserialize(response_data, response_type)
File "/Users/perbu/Library/Caches/pypoetry/virtualenvs/argo-kicker-cI2Nxebk-py3.7/lib/python3.7/site-packages/argo/workflows/client/api_client.py", line 264, in deserialize
return self.__deserialize(data, response_type)
File "/Users/perbu/Library/Caches/pypoetry/virtualenvs/argo-kicker-cI2Nxebk-py3.7/lib/python3.7/site-packages/argo/workflows/client/api_client.py", line 303, in __deserialize
return self.__deserialize_model(data, klass)
File "/Users/perbu/Library/Caches/pypoetry/virtualenvs/argo-kicker-cI2Nxebk-py3.7/lib/python3.7/site-packages/argo/workflows/client/api_client.py", line 639, in __deserialize_model
kwargs[attr] = self.__deserialize(value, attr_type)
File "/Users/perbu/Library/Caches/pypoetry/virtualenvs/argo-kicker-cI2Nxebk-py3.7/lib/python3.7/site-packages/argo/workflows/client/api_client.py", line 303, in __deserialize
return self.__deserialize_model(data, klass)
File "/Users/perbu/Library/Caches/pypoetry/virtualenvs/argo-kicker-cI2Nxebk-py3.7/lib/python3.7/site-packages/argo/workflows/client/api_client.py", line 639, in __deserialize_model
kwargs[attr] = self.__deserialize(value, attr_type)
File "/Users/perbu/Library/Caches/pypoetry/virtualenvs/argo-kicker-cI2Nxebk-py3.7/lib/python3.7/site-packages/argo/workflows/client/api_client.py", line 281, in __deserialize
for sub_data in data]
File "/Users/perbu/Library/Caches/pypoetry/virtualenvs/argo-kicker-cI2Nxebk-py3.7/lib/python3.7/site-packages/argo/workflows/client/api_client.py", line 281, in <listcomp>
for sub_data in data]
File "/Users/perbu/Library/Caches/pypoetry/virtualenvs/argo-kicker-cI2Nxebk-py3.7/lib/python3.7/site-packages/argo/workflows/client/api_client.py", line 303, in __deserialize
return self.__deserialize_model(data, klass)
File "/Users/perbu/Library/Caches/pypoetry/virtualenvs/argo-kicker-cI2Nxebk-py3.7/lib/python3.7/site-packages/argo/workflows/client/api_client.py", line 639, in __deserialize_model
kwargs[attr] = self.__deserialize(value, attr_type)
File "/Users/perbu/Library/Caches/pypoetry/virtualenvs/argo-kicker-cI2Nxebk-py3.7/lib/python3.7/site-packages/argo/workflows/client/api_client.py", line 303, in __deserialize
return self.__deserialize_model(data, klass)
File "/Users/perbu/Library/Caches/pypoetry/virtualenvs/argo-kicker-cI2Nxebk-py3.7/lib/python3.7/site-packages/argo/workflows/client/api_client.py", line 641, in __deserialize_model
instance = klass(**kwargs)
File "/Users/perbu/Library/Caches/pypoetry/virtualenvs/argo-kicker-cI2Nxebk-py3.7/lib/python3.7/site-packages/kubernetes/client/models/v1_container.py", line 123, in __init__
self.name = name
File "/Users/perbu/Library/Caches/pypoetry/virtualenvs/argo-kicker-cI2Nxebk-py3.7/lib/python3.7/site-packages/kubernetes/client/models/v1_container.py", line 350, in name
raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501
ValueError: Invalid value for `name`, must not be `None`
The python script trying to submit the workflow looks like this:
import requests
import yaml
from argo.workflows.client import V1alpha1Api
from argo.workflows.config import load_kube_config
load_kube_config()
api = V1alpha1Api()
namespace = "mottak"
wfs = api.list_namespaced_workflows(namespace=namespace)
if (wfs):
print('Argo seems to work....')
# hello-world example
m_fh = open('hello-world.yaml','r')
manifest: dict = yaml.safe_load(m_fh)
print('Got the manifest.')
# Submit the Workflow to the `argo` namespace
api.create_namespaced_workflow(namespace, manifest)
print('submitted')
The interesting thing is that the workflow gets submitted. After running the above:
(argo-kicker-cI2Nxebk-py3.7) ➜ argo-kicker git:(master) ✗ argo list
NAME STATUS AGE DURATION PRIORITY
hello-world-zdnrp Running 3s 3s 0
I've tried editing the workflow. Adding a name to the container changes the errors. I get the following trace:
Traceback (most recent call last):
File "submit.py", line 24, in <module>
api.create_namespaced_workflow(namespace, manifest)
File "/Users/perbu/Library/Caches/pypoetry/virtualenvs/argo-kicker-cI2Nxebk-py3.7/lib/python3.7/site-packages/argo/workflows/client/api/v1alpha1_api.py", line 311, in create_namespaced_workflow
return self.create_namespaced_workflow_with_http_info(namespace, body, **kwargs) # noqa: E501
File "/Users/perbu/Library/Caches/pypoetry/virtualenvs/argo-kicker-cI2Nxebk-py3.7/lib/python3.7/site-packages/argo/workflows/client/api/v1alpha1_api.py", line 408, in create_namespaced_workflow_with_http_info
collection_formats=collection_formats)
File "/Users/perbu/Library/Caches/pypoetry/virtualenvs/argo-kicker-cI2Nxebk-py3.7/lib/python3.7/site-packages/argo/workflows/client/api_client.py", line 353, in call_api
_preload_content, _request_timeout, _host)
File "/Users/perbu/Library/Caches/pypoetry/virtualenvs/argo-kicker-cI2Nxebk-py3.7/lib/python3.7/site-packages/argo/workflows/client/api_client.py", line 192, in __call_api
return_data = self.deserialize(response_data, response_type)
File "/Users/perbu/Library/Caches/pypoetry/virtualenvs/argo-kicker-cI2Nxebk-py3.7/lib/python3.7/site-packages/argo/workflows/client/api_client.py", line 264, in deserialize
return self.__deserialize(data, response_type)
File "/Users/perbu/Library/Caches/pypoetry/virtualenvs/argo-kicker-cI2Nxebk-py3.7/lib/python3.7/site-packages/argo/workflows/client/api_client.py", line 303, in __deserialize
return self.__deserialize_model(data, klass)
File "/Users/perbu/Library/Caches/pypoetry/virtualenvs/argo-kicker-cI2Nxebk-py3.7/lib/python3.7/site-packages/argo/workflows/client/api_client.py", line 641, in __deserialize_model
instance = klass(**kwargs)
File "/Users/perbu/Library/Caches/pypoetry/virtualenvs/argo-kicker-cI2Nxebk-py3.7/lib/python3.7/site-packages/argo/workflows/client/models/v1alpha1_workflow.py", line 72, in __init__
self.status = status
File "/Users/perbu/Library/Caches/pypoetry/virtualenvs/argo-kicker-cI2Nxebk-py3.7/lib/python3.7/site-packages/argo/workflows/client/models/v1alpha1_workflow.py", line 185, in status
raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501
ValueError: Invalid value for `status`, must not be `None`
Any advice would be welcome.
Per.
argo-workflows==3.2.0 argo backend is v2.8.0
Hey, how did you solved this problem? I have this problem too ...
code ` from argo.workflows.client import V1alpha1Api from argo.workflows.config import load_kube_config
load_kube_config()
v1alpha1 = V1alpha1Api() wfs = v1alpha1.list_namespaced_workflows(namespace="test-xmai-batch") print(wfs) `
➜ ~ python3 --version Python 3.7.4
➜ ~ argo version argo: v2.6.4 BuildDate: 2020-04-16T02:09:47Z GitCommit: e6caf9845976c9c61e5dc66842c30fd41bde952b GitTreeState: clean GitTag: v2.6.4 GoVersion: go1.13.4 Compiler: gc Platform: darwin/amd64
argo-workflows-3.2.0
I didn't. I've dropped argo-client-python from my project and I'm just using the CLI to submit workflows. From what I can see the project looks abandoned and hasn't kept up with Argo development.
If you look at the the other issues you'll find forks that might or might not work. But I would be careful on putting too much reliance on an open source project where the only usage example doesn't work.
That's a pity.