Skip to content

Example fails - ValueError: Invalid value for name, must not be None #26

@perbu

Description

@perbu

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions