【问题标题】:Rest calls from python script Kubeflow pipeline来自 python 脚本 Kubeflow 管道的休息调用
【发布时间】:2021-10-25 00:55:19
【问题描述】:

我正在使用 kubeflow 管道 rest API 来为 kubeflow 管道中的现有管道启动新的运行,并且在将 API 用于 POST 请求时,我不断收到错误消息。这是我的代码示例 - 我已经通过请求会话对自己进行了身份验证,并且我正在使用 python 请求包来执行 POST/GET 请求。我已将管道和实验 ID 替换为 $experimentID 和 $pipelineid

runURL = f"{HOST}/pipeline/apis/v1beta1/runs"
inputobject2={"description":"","name":"gcd_test3","pipeline_spec":
{"parameters":[{"name":"a","value":"70"},{"name":"b","value":"35"},{"name":"c","value":"42"},{"name":"d","value":"14"}]},
"resource_references":[{"key":{"id":"$experimentID","type":"EXPERIMENT"},"relationship":"OWNER"},
{"key":{"id":"$pipelineid","type":"PIPELINE_VERSION"},"relationship":"CREATOR"}],"service_account":""}
headers2 = {
        "Content-Type": "application/json"
    }
output = session.post(runURL, data=inputobject2, headers = headers2)
pp.pprint(output)
pp.pprint(output.json())

这个的打印输出是

<Response [400]>
{'code': 3,
 'details': [{'@type': 'type.googleapis.com/api.Error',
              'error_details': 'Invalid input error: ListRuns must filter by '
                               'resource reference in multi-user mode.',
              'error_message': 'ListRuns must filter by resource reference in '
                               'multi-user mode.'}],
 'error': 'Invalid input error: ListRuns must filter by resource reference in '
          'multi-user mode.',
 'message': 'Invalid input error: ListRuns must filter by resource reference '
            'in multi-user mode.'}

我只为 POST 请求获得此输出,而 GET 请求对我来说工作得很好。谢谢!

【问题讨论】:

    标签: python python-requests kubeflow-pipelines


    【解决方案1】:

    似乎缺少命名空间,这在多用户环境中似乎是必需的。

    请记住,您可以使用 Python SDK [1] 来创建运行 [2]。

    [1]https://www.kubeflow.org/docs/components/pipelines/tutorials/sdk-examples/

    [2]https://github.com/kubeflow/pipelines/blob/master/tools/benchmarks/run_service_api.ipynb

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-02-15
      • 2020-12-08
      • 1970-01-01
      • 1970-01-01
      • 2022-01-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多