Skip to content

Commit

Permalink
add a configuration parameter for specifying the task hub parameters …
Browse files Browse the repository at this point in the history
…file (#424)
  • Loading branch information
sebastianburckhardt authored Oct 2, 2024
1 parent d00a2c6 commit acb09ba
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
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

0 comments on commit acb09ba

Please sign in to comment.