argo-workflows: "Invalid type for variable 'received_data'" when getting logs using the python client
I’m trying to get workflow logs using the python client library but an ApiTypeError exception is raised with message argo_workflows.exceptions.ApiTypeError: Invalid type for variable 'received_data'. Required value type is StreamResultOfIoArgoprojWorkflowV1alpha1LogEntry and passed type was str at ['received_data']
. Any solutions or workarounds for this? _check_return_type=False
did not help.
code:
from pprint import pprint
import argo_workflows
from argo_workflows import ApiException
from argo_workflows.api import workflow_service_api
configuration = argo_workflows.Configuration(host="https://localhost:8111")
configuration.verify_ssl = False
api_client = argo_workflows.ApiClient(configuration)
api_instance = workflow_service_api.WorkflowServiceApi(api_client)
namespace = 'argo'
name = 'hello-world-vnsdv'
api_response = api_instance.workflow_logs(namespace, name, _check_return_type=False)
pprint(api_response)
Exception Traceback:
Traceback (most recent call last):
File "/home/gmouchakis/git/workflow-service/list.py", line 32, in <module>
api_response = api_instance.workflow_logs(
File "/home/gmouchakis/git/workflow-service/venv/lib/python3.8/site-packages/argo_workflows/api_client.py", line 771, in __call__
return self.callable(self, *args, **kwargs)
File "/home/gmouchakis/git/workflow-service/venv/lib/python3.8/site-packages/argo_workflows/api/workflow_service_api.py", line 2505, in __workflow_logs
return self.call_with_http_info(**kwargs)
File "/home/gmouchakis/git/workflow-service/venv/lib/python3.8/site-packages/argo_workflows/api_client.py", line 833, in call_with_http_info
return self.api_client.call_api(
File "/home/gmouchakis/git/workflow-service/venv/lib/python3.8/site-packages/argo_workflows/api_client.py", line 408, in call_api
return self.__call_api(resource_path, method,
File "/home/gmouchakis/git/workflow-service/venv/lib/python3.8/site-packages/argo_workflows/api_client.py", line 223, in __call_api
return_data = self.deserialize(
File "/home/gmouchakis/git/workflow-service/venv/lib/python3.8/site-packages/argo_workflows/api_client.py", line 324, in deserialize
deserialized_data = validate_and_convert_types(
File "/home/gmouchakis/git/workflow-service/venv/lib/python3.8/site-packages/argo_workflows/model_utils.py", line 1540, in validate_and_convert_types
converted_instance = attempt_convert_item(
File "/home/gmouchakis/git/workflow-service/venv/lib/python3.8/site-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 'received_data'. Required value type is StreamResultOfIoArgoprojWorkflowV1alpha1LogEntry and passed type was str at ['received_data']
argo version:
$ argo version
argo: v3.2.6
BuildDate: 2021-12-17T20:59:31Z
GitCommit: db7d90a1f609685cfda73644155854b06fa5d28b
GitTreeState: clean
GitTag: v3.2.6
GoVersion: go1.16.12
Compiler: gc
Platform: linux/amd64
python client version:
argo-workflows==6.3.0rc2
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 26 (11 by maintainers)
Commits related to this issue
- fix: Fix response type for artifact service OpenAPI and SDKs. Fixes ##7781 Signed-off-by: Alex Collins <alex_collins@intuit.com> — committed to argoproj/argo-workflows by alexec 2 years ago
- fix: Fix response type for artifact service OpenAPI and SDKs. Fixes #7781 (#8332) Signed-off-by: Alex Collins <alex_collins@intuit.com> — committed to argoproj/argo-workflows by alexec 2 years ago
- fix: Fix response type for artifact service OpenAPI and SDKs. Fixes #7781 (#8332) Signed-off-by: Alex Collins <alex_collins@intuit.com> — committed to argoproj/argo-workflows by alexec 2 years ago
Also ran into this issue on v3.4.1, a temporary workaround I used is to set the “preload_content” flag to “False”
and then parse the result with
api_response.read().decode("utf-8")
and to get the actual log lines
not ideal…but unblocks us for now
@terrytangyuan I started exploring this and it’s a bit unclear to me what is really going on. I attempted performing the call with a
pod_name
as well but nothing comes back from the Argo server (I edited the library code on local and added a bunch of print statements around the API response and it’s… empty, even if there are logs). I have to dive into this and see whether the server does not return the data at all.Thanks for looking into it!