Closed 66li closed 2 years ago
Thanks for reporting. Yes this is a known issue and I haven't got a chance to fix it yet. Feel free to submit a PR if you can locate that root cause.
Possibly related issues with OpenAPI generator:
cc @flaviuvadan since you have fixed a similar issue in Hera.
@66li try to submit it with:
api_response = api_instance.workflow_service_create_workflow(
namespace='argo',
body=IoArgoprojWorkflowV1alpha1WorkflowCreateRequest(
workflow=manifest, _check_return_type=False))
Just a quick heads up. I was demonstrating to someone and decided to run this code again, including the line:
body=IoArgoprojWorkflowV1alpha1WorkflowCreateRequest(workflow=manifest, _check_return_type=False, _check_type=False))
But I received the same error as the original reporter. This is the example code from the repo:
#!/usr/bin/env python
#import json
from pprint import pprint
import argo_workflows
from argo_workflows.api import workflow_service_api
from argo_workflows.model.io_argoproj_workflow_v1alpha1_workflow_create_request import \
IoArgoprojWorkflowV1alpha1WorkflowCreateRequest
import requests
import yaml
configuration = argo_workflows.Configuration(host="https://127.0.0.1:2746")
configuration.verify_ssl = False
resp = requests.get('https://raw.githubusercontent.com/argoproj/argo-workflows/master/examples/hello-world.yaml')
manifest = yaml.safe_load(resp.text)
# print(json.dumps(manifest, indent=4))
api_client = argo_workflows.ApiClient(configuration)
api_instance = workflow_service_api.WorkflowServiceApi(api_client)
api_response = api_instance.create_workflow(
namespace='argo',
body=IoArgoprojWorkflowV1alpha1WorkflowCreateRequest(workflow=manifest, _check_return_type=False, _check_type=False))
pprint(api_response)
To recreate, perhaps this script can help do it quickly:
#!/bin/bash
python3 -m venv venv3
. ./venv3/bin/activate
pip install -U pip
pip install \
wheel \
requests \
pyyaml \
git+https://github.com/argoproj/argo-workflows@master#subdirectory=sdks/python/client
#
python example.py
I am hopeful there is simply a step I missed somewhere.
@flaviuvadan Could you double-check on this when you start migrating to the new SDK?
Hey @dixon1e! I think the call should be:
api_response = api_instance.create_workflow(
namespace='argo',
body=IoArgoprojWorkflowV1alpha1WorkflowCreateRequest(workflow=manifest, _check_type=False), _check_return_type=False)
The _check_return_type=False
goes on the create_workflow
call rather than the body specification.
@flaviuvadan I will check ASAP.
Great catch! I am fixing the examples in https://github.com/argoproj/argo-workflows/pull/7731.
Confirmed moving the parameters to the correct call removes the error. The code we (@66li and I) used is the example code in the README, specifically argo-workflows/sdks/python/README.md.
EDIT: I see @terrytangyuan has fixed the doco, well done.
Great to hear. Thanks for spotting it @dixon1e and @flaviuvadan for taking a quick look!
Summary
I tried to run the python-client example. used kubectl port-forward to forward the workflow port to the local. When I ran the following code, the workflow was successfully created but I got some errors.