Skip to content

Commit d717b6e

Browse files
authored
Replace ProcessingJobBytesToRead with more generic ProcessingUnitBytesToRead (#5127)
* Add processing job bytes to read parameter to the doc * removed new * job -> unit * doc back
1 parent df46f1d commit d717b6e

File tree

9 files changed

+25
-25
lines changed

9 files changed

+25
-25
lines changed

src/Microsoft.Health.Fhir.Core/Extensions/ImportMediatorExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ public static async Task<CreateImportResponse> ImportAsync(
2828
bool allowNegativeVersions,
2929
string errorContainerName,
3030
bool eventualConsistency,
31-
int processingJobBytesToRead,
31+
int processingUnitBytesToRead,
3232
CancellationToken cancellationToken)
3333
{
3434
EnsureArg.IsNotNull(mediator, nameof(mediator));
3535
EnsureArg.IsNotNull(requestUri, nameof(requestUri));
3636

37-
var request = new CreateImportRequest(requestUri, inputFormat, inputSource, input, storageDetail, importMode, allowNegativeVersions, errorContainerName, eventualConsistency, processingJobBytesToRead);
37+
var request = new CreateImportRequest(requestUri, inputFormat, inputSource, input, storageDetail, importMode, allowNegativeVersions, errorContainerName, eventualConsistency, processingUnitBytesToRead);
3838

3939
CreateImportResponse response = await mediator.Send(request, cancellationToken);
4040
return response;

src/Microsoft.Health.Fhir.Core/Features/Operations/Import/CreateImportRequestHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public async Task<CreateImportResponse> Handle(CreateImportRequest request, Canc
6262
AllowNegativeVersions = request.AllowNegativeVersions,
6363
EventualConsistency = request.EventualConsistency,
6464
ErrorContainerName = request.ErrorContainerName,
65-
ProcessingJobBytesToRead = request.ProcessingJobBytesToRead,
65+
ProcessingUnitBytesToRead = request.ProcessingUnitBytesToRead,
6666
};
6767

6868
var jobInfo = (await _queueClient.EnqueueAsync(QueueType.Import, cancellationToken, definitions: definitionObj))[0];

src/Microsoft.Health.Fhir.Core/Features/Operations/Import/ImportOrchestratorJobDefinition.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,6 @@ public class ImportOrchestratorJobDefinition : IJobData
7575
/// If not speficied it is 10 million bytes. In case of very large resources (binary data),
7676
/// this should be increased to the resource size to avoid unnecessary input file scans.
7777
/// </summary>
78-
public int ProcessingJobBytesToRead { get; set; }
78+
public int ProcessingUnitBytesToRead { get; set; }
7979
}
8080
}

src/Microsoft.Health.Fhir.Core/Features/Operations/Import/Models/ImportRequest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,6 @@ public class ImportRequest
6363
/// <summary>
6464
/// Number of bytes to be read by processing job.
6565
/// </summary>
66-
public int ProcessingJobBytesToRead { get; set; }
66+
public int ProcessingUnitBytesToRead { get; set; }
6767
}
6868
}

src/Microsoft.Health.Fhir.Core/Messages/BulkImport/CreateImportRequest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public CreateImportRequest(
2424
bool allowNegativeVersions,
2525
string errorContainerName,
2626
bool eventualConsistency,
27-
int processingJobBytesToRead)
27+
int processingUnitBytesToRead)
2828
{
2929
EnsureArg.IsNotNull(requestUri, nameof(requestUri));
3030

@@ -37,7 +37,7 @@ public CreateImportRequest(
3737
AllowNegativeVersions = allowNegativeVersions;
3838
ErrorContainerName = errorContainerName;
3939
EventualConsistency = eventualConsistency;
40-
ProcessingJobBytesToRead = processingJobBytesToRead;
40+
ProcessingUnitBytesToRead = processingUnitBytesToRead;
4141
}
4242

4343
/// <summary>
@@ -92,6 +92,6 @@ public CreateImportRequest(
9292
/// <summary>
9393
/// Number of bytes to be read by processing job.
9494
/// </summary>
95-
public int ProcessingJobBytesToRead { get; set; }
95+
public int ProcessingUnitBytesToRead { get; set; }
9696
}
9797
}

src/Microsoft.Health.Fhir.Shared.Api/Controllers/ImportController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public async Task<IActionResult> Import([FromBody] Parameters importTaskParamete
118118
importRequest.AllowNegativeVersions,
119119
importRequest.ErrorContainerName,
120120
importRequest.EventualConsistency,
121-
importRequest.ProcessingJobBytesToRead,
121+
importRequest.ProcessingUnitBytesToRead,
122122
HttpContext.RequestAborted);
123123

124124
var bulkImportResult = ImportResult.Accepted();

src/Microsoft.Health.Fhir.Shared.Api/Features/Operations/Import/ImportRequestExtensions.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public static class ImportRequestExtensions
2626
public const string ForceParameterName = "force";
2727
public const string AllowNegativeVersionsParameterName = "allowNegativeVersions";
2828
public const string EventualConsistencyParameterName = "eventualConsistency";
29-
public const string ProcessingJobBytesToReadParameterName = "processingJobBytesToRead";
29+
public const string ProcessingUnitBytesToReadParameterName = "processingUnitBytesToRead";
3030
public const string ErrorContainerNameParameterName = "errorContainerName";
3131
public const string DefaultStorageDetailType = "azure-blob";
3232

@@ -105,9 +105,9 @@ public static Parameters ToParameters(this ImportRequest importRequest)
105105
parameters.Add(ErrorContainerNameParameterName, new FhirString(importRequest.ErrorContainerName));
106106
}
107107

108-
if (importRequest.ProcessingJobBytesToRead > 0)
108+
if (importRequest.ProcessingUnitBytesToRead > 0)
109109
{
110-
parameters.Add(ProcessingJobBytesToReadParameterName, new FhirString(importRequest.ProcessingJobBytesToRead.ToString()));
110+
parameters.Add(ProcessingUnitBytesToReadParameterName, new Integer(importRequest.ProcessingUnitBytesToRead));
111111
}
112112

113113
return parameters;
@@ -193,9 +193,9 @@ public static ImportRequest ExtractImportRequest(this Parameters parameters)
193193
importRequest.ErrorContainerName = errorContainerName;
194194
}
195195

196-
if (parameters.TryGetIntValue(ProcessingJobBytesToReadParameterName, out int bytesToRead))
196+
if (parameters.TryGetIntValue(ProcessingUnitBytesToReadParameterName, out int bytesToRead))
197197
{
198-
importRequest.ProcessingJobBytesToRead = bytesToRead;
198+
importRequest.ProcessingUnitBytesToRead = bytesToRead;
199199
}
200200

201201
return importRequest;

src/Microsoft.Health.Fhir.SqlServer/Features/Operations/Import/ImportOrchestratorJob.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,9 @@ private async Task EnqueueProcessingJobsAsync(JobInfo coord, ImportOrchestratorJ
236236
{
237237
var blobLength = (long)(await _integrationDataStoreClient.GetPropertiesAsync(input.Url, cancellationToken))[IntegrationDataStoreClientConstants.BlobPropertyLength];
238238
result.TotalBytes += blobLength;
239-
var bytesToRead = coordDefinition.ProcessingJobBytesToRead == 0
239+
var bytesToRead = coordDefinition.ProcessingUnitBytesToRead == 0
240240
? BytesToReadDefault
241-
: coordDefinition.ProcessingJobBytesToRead;
241+
: coordDefinition.ProcessingUnitBytesToRead;
242242
foreach (var offset in GetOffsets(blobLength, bytesToRead))
243243
{
244244
var newInput = input.Clone();

test/Microsoft.Health.Fhir.Shared.Tests.E2E/Rest/Import/ImportTests.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -336,17 +336,17 @@ private async Task<Uri> CreateNDJson(int resources)
336336
}
337337

338338
[Fact]
339-
public async Task ProcessingJobBytesToReadHonored()
339+
public async Task ProcessingUnitBytesToReadHonored()
340340
{
341341
var ndJson = CreateTestPatient(Guid.NewGuid().ToString("N"));
342342

343343
//// set small bytes to read, so there are multiple processing jobs
344-
var request = CreateImportRequest((await ImportTestHelper.UploadFileAsync(ndJson, _fixture.StorageAccount)).location, ImportMode.IncrementalLoad, processingJobBytesToRead: 10);
344+
var request = CreateImportRequest((await ImportTestHelper.UploadFileAsync(ndJson, _fixture.StorageAccount)).location, ImportMode.IncrementalLoad, processingUnitBytesToRead: 10);
345345
var result = await ImportCheckAsync(request, null, 0, true);
346346
Assert.Equal(7, result.Output.Count); // 7 processing jobs
347347

348348
//// no details
349-
request = CreateImportRequest((await ImportTestHelper.UploadFileAsync(ndJson, _fixture.StorageAccount)).location, ImportMode.IncrementalLoad, processingJobBytesToRead: 10);
349+
request = CreateImportRequest((await ImportTestHelper.UploadFileAsync(ndJson, _fixture.StorageAccount)).location, ImportMode.IncrementalLoad, processingUnitBytesToRead: 10);
350350
result = await ImportCheckAsync(request, null, 0, false);
351351
Assert.Single(result.Output);
352352

@@ -356,7 +356,7 @@ public async Task ProcessingJobBytesToReadHonored()
356356
Assert.Single(result.Output);
357357

358358
//// 0 should be ovewritten by default in orchestrator job
359-
request = CreateImportRequest((await ImportTestHelper.UploadFileAsync(ndJson, _fixture.StorageAccount)).location, ImportMode.IncrementalLoad, processingJobBytesToRead: 0);
359+
request = CreateImportRequest((await ImportTestHelper.UploadFileAsync(ndJson, _fixture.StorageAccount)).location, ImportMode.IncrementalLoad, processingUnitBytesToRead: 0);
360360
result = await ImportCheckAsync(request, null, 0, true);
361361
Assert.Single(result.Output);
362362
}
@@ -1184,7 +1184,7 @@ private static DateTimeOffset GetLastUpdated(string lastUpdatedYear)
11841184
return DateTimeOffset.Parse(lastUpdatedYear + "-01-01T00:00:00.000+00:00");
11851185
}
11861186

1187-
private static ImportRequest CreateImportRequest(IList<Uri> locations, ImportMode importMode, bool setResourceType = true, bool allowNegativeVersions = false, string errorContainerName = null, bool eventualConsistency = false, int? processingJobBytesToRead = null)
1187+
private static ImportRequest CreateImportRequest(IList<Uri> locations, ImportMode importMode, bool setResourceType = true, bool allowNegativeVersions = false, string errorContainerName = null, bool eventualConsistency = false, int? processingUnitBytesToRead = null)
11881188
{
11891189
var input = locations.Select(location =>
11901190
{
@@ -1209,17 +1209,17 @@ private static ImportRequest CreateImportRequest(IList<Uri> locations, ImportMod
12091209
ErrorContainerName = errorContainerName,
12101210
};
12111211

1212-
if (processingJobBytesToRead.HasValue)
1212+
if (processingUnitBytesToRead.HasValue)
12131213
{
1214-
request.ProcessingJobBytesToRead = processingJobBytesToRead.Value;
1214+
request.ProcessingUnitBytesToRead = processingUnitBytesToRead.Value;
12151215
}
12161216

12171217
return request;
12181218
}
12191219

1220-
private static ImportRequest CreateImportRequest(Uri location, ImportMode importMode, bool setResourceType = true, bool allowNegativeVersions = false, string errorContainerName = null, bool eventualConsistency = false, int? processingJobBytesToRead = null)
1220+
private static ImportRequest CreateImportRequest(Uri location, ImportMode importMode, bool setResourceType = true, bool allowNegativeVersions = false, string errorContainerName = null, bool eventualConsistency = false, int? processingUnitBytesToRead = null)
12211221
{
1222-
return CreateImportRequest([location], importMode, setResourceType, allowNegativeVersions, errorContainerName, eventualConsistency, processingJobBytesToRead);
1222+
return CreateImportRequest([location], importMode, setResourceType, allowNegativeVersions, errorContainerName, eventualConsistency, processingUnitBytesToRead);
12231223
}
12241224

12251225
private static string PrepareResource(string id, string version, string lastUpdatedYear)

0 commit comments

Comments
 (0)