Skip to content

Commit

Permalink
Enable FR StarTraining (Azure#11322)
Browse files Browse the repository at this point in the history
* starttraining

* no null
  • Loading branch information
maririos authored Apr 15, 2020
1 parent 94b88ae commit b40c5ba
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,10 @@ public FormTrainingClient(Uri endpoint, AzureKeyCredential credential, FormRecog
[ForwardsClientCalls]
public virtual TrainingOperation StartTraining(Uri trainingFiles, bool useLabels = false, TrainingFileFilter filter = default, CancellationToken cancellationToken = default)
{
throw new NotImplementedException();

//TrainRequest_internal trainRequest = new TrainRequest_internal() { Source = trainingFiles.AbsoluteUri };

//// TODO: Q1 - if there's a way to default a property value, set filter.Path ="" and set it here in a nicer way.
//// https://github.com/Azure/autorest.csharp/issues/467
//// When this is complete, we will be able to default filter.Path to "".
//// Decision to make, do we always send filter, or only if needed?
//// Tracking with https://github.com/Azure/azure-sdk-for-net/issues/10359
//if (filter != default)
//{
// trainRequest.SourceFilter = filter;
//}

//ResponseWithHeaders<TrainCustomModelAsyncHeaders> response = ServiceClient.RestClient.TrainCustomModelAsync(trainRequest);
//return new TrainingOperation(ServiceClient, response.Headers.Location);
var trainRequest = new TrainRequest_internal(trainingFiles.AbsoluteUri, filter, useLabels);

ResponseWithHeaders<ServiceTrainCustomModelAsyncHeaders> response = ServiceClient.RestClient.TrainCustomModelAsync(trainRequest);
return new TrainingOperation(response.Headers.Location, ServiceClient);
}

/// <summary>
Expand All @@ -88,20 +76,10 @@ public virtual TrainingOperation StartTraining(Uri trainingFiles, bool useLabels
[ForwardsClientCalls]
public virtual async Task<TrainingOperation> StartTrainingAsync(Uri trainingFiles, bool useLabels = false, TrainingFileFilter filter = default, CancellationToken cancellationToken = default)
{
await Task.Run(() => { }).ConfigureAwait(false);
throw new NotImplementedException();

//TrainRequest_internal trainRequest = new TrainRequest_internal() { Source = trainingFiles.AbsoluteUri };

//// TODO: Q1 - if there's a way to default a property value, set filter.Path ="" and set it here in a nicer way.
//// https://github.com/Azure/azure-sdk-for-net/issues/10359
//if (filter != default)
//{
// trainRequest.SourceFilter = filter;
//}
var trainRequest = new TrainRequest_internal(trainingFiles.AbsoluteUri, filter, useLabels);

//ResponseWithHeaders<TrainCustomModelAsyncHeaders> response = await ServiceClient.RestClient.TrainCustomModelAsyncAsync(trainRequest).ConfigureAwait(false);
//return new TrainingOperation(ServiceClient, response.Headers.Location);
ResponseWithHeaders<ServiceTrainCustomModelAsyncHeaders> response = await ServiceClient.RestClient.TrainCustomModelAsyncAsync(trainRequest).ConfigureAwait(false);
return new TrainingOperation(response.Headers.Location, ServiceClient);
}

/// <summary>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,12 @@ public partial class TrainingFileFilter
internal TrainingFileFilter()
{
}

/// <inheritdoc />
public string Prefix { get; set; } = string.Empty;

/// <inheritdoc />
public bool IncludeSubFolders { get; set; } = false;

}
}

0 comments on commit b40c5ba

Please sign in to comment.