Skip to content

Commit

Permalink
implement cancel (Azure#28817)
Browse files Browse the repository at this point in the history
  • Loading branch information
maririos authored May 17, 2022
1 parent 2931c0a commit 7f64564
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1437,22 +1437,21 @@ public override Response<HealthcareJobStatusResult> HealthStatusNextPage(string
}
}

// NEEDS IMPLEMENTATION
public override async Task CancelHealthcareJobAsync(string jobId, CancellationToken cancellationToken = default)
{
Argument.AssertNotNull(jobId, nameof(jobId));

if (!Guid.TryParse(jobId, out var id))
{
throw new FormatException($"{nameof(jobId)} is not a valid GUID.");
}

using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(TextAnalyticsClient)}.{nameof(CancelHealthcareJobAsync)}");
scope.Start();

try
{
await Task.Yield();
throw new NotImplementedException();
//var result = << NO HEALTHCARE SERVICE METHOD >>
//var status = Transforms.ConvertToHealthcareJobStatusResult(result.Value, idToIndexMap);

//return Response.FromValue(status, result.GetRawResponse());
await _languageRestClient.AnalyzeBatchCancelJobAsync(id, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
Expand All @@ -1461,22 +1460,22 @@ public override async Task CancelHealthcareJobAsync(string jobId, CancellationTo
}
}

// NEEDS IMPLEMENTATION
public override void CancelHealthcareJob(string jobId, CancellationToken cancellationToken = default)
{
{
Argument.AssertNotNull(jobId, nameof(jobId));

if (!Guid.TryParse(jobId, out var id))
{
throw new FormatException($"{nameof(jobId)} is not a valid GUID.");
}

using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(TextAnalyticsClient)}.{nameof(CancelHealthcareJob)}");
scope.Start();

try
{
throw new NotImplementedException();
//var result = << NO HEALTHCARE SERVICE METHOD >>
//var status = Transforms.ConvertToHealthcareJobStatusResult(result.Value, idToIndexMap);

//return Response.FromValue(status, result.GetRawResponse());
_languageRestClient.AnalyzeBatchCancelJob(id, cancellationToken);
}
catch (Exception e)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace Azure.AI.TextAnalytics.Samples
public partial class TextAnalyticsSamples : TextAnalyticsSampleBase
{
[Test]
[Ignore("LRO not implemented")]
public async Task AnalyzeHealthcareEntitiesAsync_Cancellation()
{
string endpoint = TestEnvironment.Endpoint;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ namespace Azure.AI.TextAnalytics.Samples
public partial class TextAnalyticsSamples : TextAnalyticsSampleBase
{
[Test]
[Ignore("LRO not implemented")]
public void AnalyzeHealthcareEntities_Cancellation()
{
string endpoint = TestEnvironment.Endpoint;
Expand Down

0 comments on commit 7f64564

Please sign in to comment.