我正在运行云数据流作业,这给了我以下错误
java.util.concurrent.ExecutionException: java.lang.RuntimeException: Error received from SDK harness for instruction -156: Traceback (most recent call last):
File "apache_beam/runners/common.py", line 813, in apache_beam.runners.common.DoFnRunner.process
File "apache_beam/runners/common.py", line 610, in apache_beam.runners.common.PerWindowInvoker.invoke_process
File "apache_beam/runners/common.py", line 685, in apache_beam.runners.common.PerWindowInvoker._invoke_process_per_window
File "review_data_sim_pipeline_filter.py", line 47, in process
File "review_data_sim_pipeline_filter.py", line 31, in predict_json
File "/usr/local/lib/python3.5/site-packages/googleapiclient/_helpers.py", line 130, in positional_wrapper
return wrapped(*args, **kwargs)
File "/usr/local/lib/python3.5/site-packages/googleapiclient/http.py", line 856, in execute
raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 404 when requesting https://ml.googleapis.com/v1/projects/<myprojectname>/models/xgb_cloudml_train:predict?alt=json returned "Field: name Error: The model resource: "xgb_cloudml_train" was not found. Please create the Cloud ML model resource first by using 'gcloud ml-engine models create xgb_cloudml_train'.". Details: "[{'@type': 'type.googleapis.com/google.rpc.BadRequest', 'fieldViolations': [{'description': 'The model resource: "xgb_cloudml_train" was not found. Please create the Cloud ML model resource first by using \'gcloud ml-engine models create xgb_cloudml_train\'.', 'field': 'name'}]}]">
但是我的模型确实存在,并且当我使用代码时
def predict_json(self, project, model, instances, version=None):
import googleapiclient.discovery
service = googleapiclient.discovery.build('ml', 'v1', discoveryServiceUrl='https://storage.googleapis.com/cloud-ml/discovery/ml_v1_discovery.json',cache_discovery=True)
name = 'projects/{}/models/{}'.format(project, model)
if version is not None:
name += '/versions/{}'.format(version)
response = service.projects().predict(
name=name,
body={'instances': instances}
).execute()
if 'error' in response:
raise RuntimeError(response['error'])
return response['predictions']
我得到回应。但是,当我与cloud ml一起使用时,出现此错误。请帮助
https://ml.googleapis.com/v1/projects/<myprojectname>/models/xgb_cloudml_train:predict