0

我正在 Cloud Healthcare API GitHub 教程上尝试 ML Codelabs 的 AutoML Vision。 https://github.com/GoogleCloudPlatform/healthcare/blob/master/imaging/ml_codelab/breast_density_auto_ml.ipynb

我运行将 DICOM 转换为 JPEG 部分的导出 DICOM 数据单元代码,请求以及所有前提单元代码都成功。

但是等待操作完成会超时并且永远不会完成。(数据集页面上的 ExportDicomData 请求状态在一天内保持“正在运行”。我做了很多次,但所有请求都堆积在“正在运行”。有几次我尝试从头开始做,结果是一样的。)

到目前为止我做了:

1) 删除“output_config”,因为发生 INVALID ARGUMENT 错误。 https://github.com/GoogleCloudPlatform/healthcare/issues/133

2) 启用 Cloud Resource Manager API,因为它是需要的。

这是单元格代码。

# Path to export DICOM data.
dicom_store_url = os.path.join(HEALTHCARE_API_URL, 'projects', project_id, 'locations', location, 'datasets', dataset_id, 'dicomStores', dicom_store_id)
path = dicom_store_url + ":export"

# Headers (send request in JSON format).
headers = {'Content-Type': 'application/json'}

# Body (encoded in JSON format).
# output_config = {'output_config': {'gcs_destination': {'uri_prefix': jpeg_folder, 'mime_type': 'image/jpeg; transfer-syntax=1.2.840.10008.1.2.4.50'}}}
output_config = {'gcs_destination': {'uri_prefix': jpeg_folder, 'mime_type': 'image/jpeg; transfer-syntax=1.2.840.10008.1.2.4.50'}}
body = json.dumps(output_config)

resp, content = http.request(path, method='POST', headers=headers, body=body)
assert resp.status == 200, 'error exporting to JPEG, code: {0}, response: {1}'.format(resp.status, content)
print('Full response:\n{0}'.format(content))

# Record operation_name so we can poll for it later.
response = json.loads(content)
operation_name = response['name']

这是等待的结果。

Waiting for operation completion...
Full response:
{
  "name": "projects/my-datalab-tutorials/locations/us-central1/datasets/sample-dataset/operations/18300485449992372225",
  "metadata": {
    "@type": "type.googleapis.com/google.cloud.healthcare.v1beta1.OperationMetadata",
    "apiMethodName": "google.cloud.healthcare.v1beta1.dicom.DicomService.ExportDicomData",
    "createTime": "2019-08-18T10:37:49.809136Z"
  }
}


AssertionErrorTraceback (most recent call last)
<ipython-input-18-1a57fd38ea96> in <module>()
     21 timeout = time.time() + 10*60 # Wait up to 10 minutes.
     22 path = os.path.join(HEALTHCARE_API_URL, operation_name)
---> 23 _ = wait_for_operation_completion(path, timeout)

<ipython-input-18-1a57fd38ea96> in wait_for_operation_completion(path, timeout)
     15 
     16   print('Full response:\n{0}'.format(content))
---> 17   assert success, "operation did not complete successfully in time limit"
     18   print('Success!')
     19   return response

AssertionError: operation did not complete successfully in time limit

API 版本为 v1beta1。

我想知道是否有人有任何建议。

谢谢你。

4

2 回答 2

0

最近对codelabs进行了更新。该错误消息是由于codelab中的超时而不是实际操作造成的。这已在更新中解决。如果您仍然遇到任何问题,请告诉我!

于 2020-02-04T19:43:15.867 回答
0

经过几次不断的尝试,跑了一晚上,终于成功了。我不知道为什么。

于 2019-08-20T12:58:57.893 回答