Skip to content
This repository has been archived by the owner on Jul 30, 2024. It is now read-only.
/ NuGet.Jobs Public archive

Commit

Permalink
[HotFix] Make concurrent batch count as tunable parameter (#483)
Browse files Browse the repository at this point in the history
  • Loading branch information
shishirx34 authored Feb 26, 2019
1 parent 2a87a94 commit b0a4dc3
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/Ng/Arguments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ public static class Arguments
public const string PreferAlternatePackageSourceStorage = "preferAlternatePackageSourceStorage";

public const string StorageUseServerSideCopy = "storageUseServerSideCopy";
public const string MaxConcurrentBatches = "maxConcurrentBatches";

#endregion

#region Catalog2Lucene
Expand Down Expand Up @@ -87,6 +89,7 @@ public static class Arguments
public const string ContentIsFlatContainer = "contentIsFlatContainer";
public const string CursorUri = "cursorUri";
public const string FlatContainerName = "flatContainerName";

#endregion

#region Catalog2PackageFixup
Expand Down
18 changes: 17 additions & 1 deletion src/Ng/Jobs/Catalog2RegistrationJob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ protected override void Init(IDictionary<string, string> arguments, Cancellation
var contentBaseAddress = arguments.GetOrDefault<string>(Arguments.ContentBaseAddress);
var galleryBaseAddress = arguments.GetOrDefault<string>(Arguments.GalleryBaseAddress);
var isContentFlatContainer = arguments.GetOrDefault<bool>(Arguments.ContentIsFlatContainer);
var maxConcurrentBatches = MaxConcurrentBatches(arguments.GetOrDefault<int>(Arguments.MaxConcurrentBatches));

// The term "legacy" here refers to the registration hives that do not contain any SemVer 2.0.0 packages.
// In production, this is two registration hives:
Expand Down Expand Up @@ -108,7 +109,8 @@ protected override void Init(IDictionary<string, string> arguments, Cancellation
galleryBaseAddress == null ? null : new Uri(galleryBaseAddress),
TelemetryService,
Logger,
CommandHelpers.GetHttpMessageHandlerFactory(TelemetryService, verbose));
CommandHelpers.GetHttpMessageHandlerFactory(TelemetryService, verbose),
maxConcurrentBatches: maxConcurrentBatches);

var cursorStorage = storageFactories.LegacyStorageFactory.Create();
_front = new DurableCursor(cursorStorage.ResolveUri("cursor.json"), cursorStorage, MemoryCursor.MinValue);
Expand All @@ -118,6 +120,20 @@ protected override void Init(IDictionary<string, string> arguments, Cancellation
TelemetryService.GlobalDimensions[TelemetryConstants.Destination] = _destination?.AbsoluteUri;
}

private int MaxConcurrentBatches(int argBatches)
{
if (argBatches < 0)
{
throw new ArgumentException($"{nameof(argBatches)} cannot be negative.");
}
if (argBatches == 0)
{
return RegistrationCollector.DefaultMaxConcurrentBatches;
}

return argBatches;
}

protected override async Task RunInternalAsync(CancellationToken cancellationToken)
{
using (Logger.BeginScope($"Logging for {{{TelemetryConstants.Destination}}}", _destination?.AbsoluteUri))
Expand Down
3 changes: 2 additions & 1 deletion src/Ng/Scripts/Catalog2RegistrationV3-Reg3-China.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ start /w ng.exe catalog2registration ^
-flatContainerName #{Jobs.China.catalog2registrationv3reg3.FlatContainerName} ^
-storageOperationMaxExecutionTimeInSeconds #{Jobs.Common.China.AzureOperationMaxTimeout} ^
-storageServerTimeoutInSeconds #{Jobs.Common.China.StorageServerTimeoutInSeconds} ^
-galleryBaseAddress #{Jobs.China.catalog2registrationv3reg3.GalleryBaseAddress}
-galleryBaseAddress #{Jobs.China.catalog2registrationv3reg3.GalleryBaseAddress} ^
-maxConcurrentBatches #{Jobs.common.v3.MaxConcurrentBatches}

echo "Finished #{Jobs.China.catalog2registrationv3reg3.Title}"

Expand Down
3 changes: 2 additions & 1 deletion src/Ng/Scripts/Catalog2RegistrationV3-Reg3.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ start /w ng.exe catalog2registration ^
-contentIsFlatContainer #{Jobs.catalog2registrationv3reg3.IsContentFlatContainer} ^
-cursorUri #{Jobs.catalog2registrationv3reg3.CursorUri} ^
-flatContainerName #{Jobs.catalog2registrationv3reg3.FlatContainerName} ^
-galleryBaseAddress #{Jobs.catalog2registrationv3reg3.GalleryBaseAddress}
-galleryBaseAddress #{Jobs.catalog2registrationv3reg3.GalleryBaseAddress} ^
-maxConcurrentBatches #{Jobs.common.v3.MaxConcurrentBatches}

echo "Finished #{Jobs.catalog2registrationv3reg3.Title}"

Expand Down

0 comments on commit b0a4dc3

Please sign in to comment.