0

我正在使用该StartEntitiesDetectionV2JobRequest功能启动 Comprehend Medical Job Request。在文档中它说“要获取作业的状态,请使用带有 DescribeEntitiesDetectionV2Job 操作的 this(JobId) 标识符”,但是没有称为 的操作DescribeEntitiesDetectionV2Job,只有DescribeEntitiesDetectionV2JobRequestDescribeEntitiesDetectionV2JobResponse

我如何调用DescribeEntitiesDetectionV2JobResponse(或任何其他函数)来获取作业的状态?

我在想这样的事情会起作用:

ComprehendMedicalAsyncJobProperties jobProperties = new ComprehendMedicalAsyncJobProperties()
                {
                    DataAccessRoleArn = "arn:aws:iam::1129587198257:role/role_name",
                    InputDataConfig = input,
                    OutputDataConfig = output
                };


                DescribeEntitiesDetectionV2JobResponse requestResponse = new DescribeEntitiesDetectionV2JobResponse()
                {
                    ComprehendMedicalAsyncJobProperties = jobProperties
                };
while(requestResponse.HttpStatusCode!=(*something that would indicate that the job is completed here*))
                {
                    Thread.Sleep(500);
                }
4

1 回答 1

0
InputDataConfig input = new InputDataConfig()
                    {
                        S3Bucket = "your_bucket_here",
                        S3Key = "subdirectory_name"
                    };
                    OutputDataConfig output = new OutputDataConfig()
                    {
                        S3Bucket = "your_bucket_here",
                        S3Key = "subdirectory_name"
                    };

                    StartEntitiesDetectionV2JobRequest request = new StartEntitiesDetectionV2JobRequest()
                    {
                        InputDataConfig = input,
                        JobName = "job_name_example",
                        LanguageCode = "en",
                        OutputDataConfig = output,
                        DataAccessRoleArn = "arn:aws:iam::12312512512:role/acces_role_name_here"
                    };
                    StartEntitiesDetectionV2JobResponse comprehendResult = comprehendClient.StartEntitiesDetectionV2JobAsync(request).GetAwaiter().GetResult();

                    DescribeEntitiesDetectionV2JobRequest entitiesDetectionV2JobRequest = new DescribeEntitiesDetectionV2JobRequest()
                    {
                        JobId = comprehendResult.JobId
                    };

                    DescribeEntitiesDetectionV2JobResponse comprehendResult2 = comprehendClient.DescribeEntitiesDetectionV2JobAsync(entitiesDetectionV2JobRequest).GetAwaiter().GetResult();
于 2021-01-03T19:55:41.583 回答