argoproj / argo-workflows

Workflow Engine for Kubernetes
https://argo-workflows.readthedocs.io/
Apache License 2.0
14.54k stars 3.12k forks source link

list_workflows-->argo_workflows.exceptions.ApiTypeError: Invalid type for variable 'finished_at' #9122

Open abhilasharevur opened 1 year ago

abhilasharevur commented 1 year ago

Checklist

* [x] Double-checked my configuration. * [ ] Tested using the latest version. * [x] Used the Emissary executor. ## Summary What happened/what you expected to happen? listing workflows using Python sdk example in the document returns this error: argo_workflows.exceptions.ApiTypeError: Invalid type for variable 'finished_at'. Required value type is datetime and passed type was NoneType at ['received_data']['items'][0]['status']['finished_at'] What version are you running? argo==3.3.7 argo-workflows==6.3.0rc2 ## Diagnostics 1. create, delete workflows work fine 2. list workflow has issue ``` from pprint import pprint import requests import argo_workflows from argo_workflows.api import workflow_service_api configuration = argo_workflows.Configuration(host="https://127.0.0.1:2746") configuration.verify_ssl = False with argo_workflows.ApiClient(configuration) as api_client: api_instance = workflow_service_api.WorkflowServiceApi(api_client) namespace = "dev" try: api_response = api_instance.list_workflows(namespace) pprint(api_response) except argo_workflows.ApiException as e: print("Exception when calling WorkflowServiceApi->list_workflows: %s\n" % e) ``` ```bash # Logs from the workflow controller: Traceback (most recent call last): File "./python_sdk_example.py", line 122, in api_response = api_instance.list_workflows(namespace) File "/usr/local/lib/python3.8/dist-packages/argo_workflows/api_client.py", line 771, in __call__ return self.callable(self, *args, **kwargs) File "/usr/local/lib/python3.8/dist-packages/argo_workflows/api/workflow_service_api.py", line 682, in __list_workflows return self.call_with_http_info(**kwargs) File "/usr/local/lib/python3.8/dist-packages/argo_workflows/api_client.py", line 833, in call_with_http_info return self.api_client.call_api( File "/usr/local/lib/python3.8/dist-packages/argo_workflows/api_client.py", line 408, in call_api return self.__call_api(resource_path, method, File "/usr/local/lib/python3.8/dist-packages/argo_workflows/api_client.py", line 223, in __call_api return_data = self.deserialize( File "/usr/local/lib/python3.8/dist-packages/argo_workflows/api_client.py", line 324, in deserialize deserialized_data = validate_and_convert_types( File "/usr/local/lib/python3.8/dist-packages/argo_workflows/model_utils.py", line 1540, in validate_and_convert_types converted_instance = attempt_convert_item( File "/usr/local/lib/python3.8/dist-packages/argo_workflows/model_utils.py", line 1436, in attempt_convert_item raise conversion_exc File "/usr/local/lib/python3.8/dist-packages/argo_workflows/model_utils.py", line 1427, in attempt_convert_item return deserialize_model(input_value, valid_class, File "/usr/local/lib/python3.8/dist-packages/argo_workflows/model_utils.py", line 1347, in deserialize_model return model_class._new_from_openapi_data(**kw_args) File "/usr/local/lib/python3.8/dist-packages/argo_workflows/model_utils.py", line 44, in wrapped_init return fn(_self, *args, **kwargs) File "/usr/local/lib/python3.8/dist-packages/argo_workflows/model_utils.py", line 343, in _new_from_openapi_data return cls._from_openapi_data(*args, **kwargs) File "/usr/local/lib/python3.8/dist-packages/argo_workflows/model_utils.py", line 44, in wrapped_init return fn(_self, *args, **kwargs) File "/usr/local/lib/python3.8/dist-packages/argo_workflows/model/io_argoproj_workflow_v1alpha1_workflow_list.py", line 184, in _from_openapi_data self.items = items File "/usr/local/lib/python3.8/dist-packages/argo_workflows/model_utils.py", line 183, in __setattr__ self[attr] = value File "/usr/local/lib/python3.8/dist-packages/argo_workflows/model_utils.py", line 483, in __setitem__ self.set_attribute(name, value) File "/usr/local/lib/python3.8/dist-packages/argo_workflows/model_utils.py", line 155, in set_attribute value = validate_and_convert_types( File "/usr/local/lib/python3.8/dist-packages/argo_workflows/model_utils.py", line 1590, in validate_and_convert_types input_value[index] = validate_and_convert_types( File "/usr/local/lib/python3.8/dist-packages/argo_workflows/model_utils.py", line 1540, in validate_and_convert_types converted_instance = attempt_convert_item( File "/usr/local/lib/python3.8/dist-packages/argo_workflows/model_utils.py", line 1436, in attempt_convert_item raise conversion_exc File "/usr/local/lib/python3.8/dist-packages/argo_workflows/model_utils.py", line 1427, in attempt_convert_item return deserialize_model(input_value, valid_class, File "/usr/local/lib/python3.8/dist-packages/argo_workflows/model_utils.py", line 1347, in deserialize_model return model_class._new_from_openapi_data(**kw_args) File "/usr/local/lib/python3.8/dist-packages/argo_workflows/model_utils.py", line 44, in wrapped_init return fn(_self, *args, **kwargs) File "/usr/local/lib/python3.8/dist-packages/argo_workflows/model_utils.py", line 343, in _new_from_openapi_data return cls._from_openapi_data(*args, **kwargs) File "/usr/local/lib/python3.8/dist-packages/argo_workflows/model_utils.py", line 44, in wrapped_init return fn(_self, *args, **kwargs) File "/usr/local/lib/python3.8/dist-packages/argo_workflows/model/io_argoproj_workflow_v1alpha1_workflow.py", line 198, in _from_openapi_data setattr(self, var_name, var_value) File "/usr/local/lib/python3.8/dist-packages/argo_workflows/model_utils.py", line 183, in __setattr__ self[attr] = value File "/usr/local/lib/python3.8/dist-packages/argo_workflows/model_utils.py", line 483, in __setitem__ self.set_attribute(name, value) File "/usr/local/lib/python3.8/dist-packages/argo_workflows/model_utils.py", line 155, in set_attribute value = validate_and_convert_types( File "/usr/local/lib/python3.8/dist-packages/argo_workflows/model_utils.py", line 1540, in validate_and_convert_types converted_instance = attempt_convert_item( File "/usr/local/lib/python3.8/dist-packages/argo_workflows/model_utils.py", line 1436, in attempt_convert_item raise conversion_exc File "/usr/local/lib/python3.8/dist-packages/argo_workflows/model_utils.py", line 1427, in attempt_convert_item return deserialize_model(input_value, valid_class, File "/usr/local/lib/python3.8/dist-packages/argo_workflows/model_utils.py", line 1347, in deserialize_model return model_class._new_from_openapi_data(**kw_args) File "/usr/local/lib/python3.8/dist-packages/argo_workflows/model_utils.py", line 44, in wrapped_init return fn(_self, *args, **kwargs) File "/usr/local/lib/python3.8/dist-packages/argo_workflows/model_utils.py", line 343, in _new_from_openapi_data return cls._from_openapi_data(*args, **kwargs) File "/usr/local/lib/python3.8/dist-packages/argo_workflows/model_utils.py", line 44, in wrapped_init return fn(_self, *args, **kwargs) File "/usr/local/lib/python3.8/dist-packages/argo_workflows/model/io_argoproj_workflow_v1alpha1_workflow_status.py", line 240, in _from_openapi_data setattr(self, var_name, var_value) File "/usr/local/lib/python3.8/dist-packages/argo_workflows/model_utils.py", line 183, in __setattr__ self[attr] = value File "/usr/local/lib/python3.8/dist-packages/argo_workflows/model_utils.py", line 483, in __setitem__ self.set_attribute(name, value) File "/usr/local/lib/python3.8/dist-packages/argo_workflows/model_utils.py", line 155, in set_attribute value = validate_and_convert_types( File "/usr/local/lib/python3.8/dist-packages/argo_workflows/model_utils.py", line 1540, in validate_and_convert_types converted_instance = attempt_convert_item( File "/usr/local/lib/python3.8/dist-packages/argo_workflows/model_utils.py", line 1422, in attempt_convert_item raise get_type_error(input_value, path_to_item, valid_classes, argo_workflows.exceptions.ApiTypeError: Invalid type for variable 'finished_at'. Required value type is datetime and passed type was NoneType at ['received_data']['items'][0]['status']['finished_at'] ``` ---

Message from the maintainers:

Impacted by this bug? Give it a 👍. We prioritise the issues with the most 👍.

abhilasharevur commented 1 year ago

There was only one workflow and it was still running when I executed "list_workflow". So the value for the variable 'finished_at' is null.

terrytangyuan commented 1 year ago

Add _check_return_type=False to your list_workflow().

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is a mentoring request, please provide an update here. Thank you for your contributions.

stale[bot] commented 1 year ago

This issue has been closed due to inactivity. Feel free to re-open if you still encounter this issue.

larsschwegmann commented 1 year ago

_check_return_type=False seems more like a workaround rather than a fix for the problem. Any plans on fixing this?

EEvacheNN commented 11 months ago

This problem is really important when I was trying to use this whole argo python client, please see this comment and consider make this function more friendly, please

agilgur5 commented 9 months ago

The SDKs are autogenerated via OpenAPI. The OpenAPI spec should allow unset finished_at; if it doesn't, that is a fixable bug.

If the SDK generation tools have a bug though, that is not necessarily fixable within Argo code.

As of right now, Hera is recommended as a Python SDK.