Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a configuration parameter for specifying the task hub parameters file #424

Merged
merged 1 commit into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ public bool TryGetScalingMonitor(out ScalingMonitor monitor)
try
{
ILoadPublisherService loadPublisher = string.IsNullOrEmpty(this.Settings.LoadInformationAzureTableName) ?
new AzureBlobLoadPublisher(this.Settings.BlobStorageConnection, this.Settings.HubName)
new AzureBlobLoadPublisher(this.Settings.BlobStorageConnection, this.Settings.HubName, this.Settings.TaskhubParametersFilePath)
: new AzureTableLoadPublisher(this.Settings.TableStorageConnection, this.Settings.LoadInformationAzureTableName, this.Settings.HubName);

monitor = new ScalingMonitor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ public class NetheriteOrchestrationServiceSettings
/// </summary>
public string PartitionManagementParameters { get; set; } = null;

/// <summary>
/// The path to the file containing the taskhub parameters.
/// </summary>
public string TaskhubParametersFilePath { get; set; } = "taskhubparameters.json";

/// <summary>
/// Gets or sets the activity scheduler option
/// </summary>
Expand Down
6 changes: 4 additions & 2 deletions src/DurableTask.Netherite/Scaling/AzureBlobLoadPublisher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class AzureBlobLoadPublisher : ILoadPublisherService
{
readonly string taskHubName;
readonly Task<CloudBlobContainer> blobContainer;
readonly string taskhubParametersFilePath;
TaskhubParameters parameters;

readonly static JsonSerializerSettings serializerSettings = new JsonSerializerSettings()
Expand All @@ -27,10 +28,11 @@ class AzureBlobLoadPublisher : ILoadPublisherService
MissingMemberHandling = MissingMemberHandling.Ignore,
};

public AzureBlobLoadPublisher(ConnectionInfo connectionInfo, string taskHubName)
public AzureBlobLoadPublisher(ConnectionInfo connectionInfo, string taskHubName, string taskHubParametersFilePath)
{
this.blobContainer = this.GetBlobContainer(connectionInfo, taskHubName);
this.taskHubName = taskHubName;
this.taskhubParametersFilePath = taskHubParametersFilePath;
}

async Task<CloudBlobContainer> GetBlobContainer(ConnectionInfo connectionInfo, string taskHubName)
Expand All @@ -54,7 +56,7 @@ async ValueTask<bool> LoadParameters(bool throwIfNotFound, CancellationToken can
if (this.parameters == null)
{
this.parameters = await this.ReadJsonBlobAsync<Netherite.Abstractions.TaskhubParameters>(
(await this.blobContainer).GetBlockBlobReference("taskhubparameters.json"),
(await this.blobContainer).GetBlockBlobReference(this.taskhubParametersFilePath),
throwIfNotFound: throwIfNotFound,
throwOnParseError: throwIfNotFound,
cancellationToken).ConfigureAwait(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ async Task<CloudBlobContainer> GetBlobContainerAsync()
async Task<CloudBlockBlob> GetTaskhubParametersAsync()
{
var cloudBlobContainer = await this.cloudBlobContainer;
return cloudBlobContainer.GetBlockBlobReference("taskhubparameters.json");
return cloudBlobContainer.GetBlockBlobReference(settings.TaskhubParametersFilePath);
}

this.traceHelper.TraceProgress("Creating LoadPublisher Service");
Expand All @@ -83,7 +83,7 @@ async Task<CloudBlockBlob> GetTaskhubParametersAsync()
}
else
{
this.LoadPublisher = new AzureBlobLoadPublisher(settings.BlobStorageConnection, settings.HubName);
this.LoadPublisher = new AzureBlobLoadPublisher(settings.BlobStorageConnection, settings.HubName, settings.TaskhubParametersFilePath);
}
}

Expand Down
2 changes: 2 additions & 0 deletions test/PerformanceTests/host.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@
// "PartitionManagement": "RecoveryTester",
// "PartitionManagementParameters": "7",

//"TaskhubParametersFilePath": "preserved-hub.json",

// set this to "Local" to disable the global activity distribution algorithm
// options: "Local", "Static", "Locavore"
"ActivityScheduler": "Locavore",
Expand Down
Loading