OneComputeWpfClient\Azure\AzureBatchWorkItemScheduler.cs
using DNV.One.Compute.Core.FlowModel;
using DNV.One.Compute.Scheduling.AzureBatch.Credentials;
using DNV.One.Compute.StorageLibrary.Settings;
using OneComputeWpfClient.Services;
namespace OneComputeWpfClient.Azure
{
/// <summary>
/// Work item scheduler for the application.
/// </summary>
public class AzureBatchWorkItemScheduler : DNV.One.Compute.Scheduling.AzureBatch.TaskScheduler.AzureBatchWorkItemScheduler
{
/// <summary>
/// Initializes a new instance of the <see cref="AzureBatchWorkItemScheduler" /> class.
/// </summary>
/// <param name="poolId">The pool identifier.</param>
/// <param name="batchCredentials">The batch credentials.</param>
/// <param name="oneComputeServices">The one compute services.</param>
public AzureBatchWorkItemScheduler(string poolId, BatchCredentials batchCredentials, OneComputeServices oneComputeServices)
: base(poolId, batchCredentials, oneComputeServices?.WorkItemStorageService, oneComputeServices?.WorkItemStatusService, oneComputeServices?.ResultStorageService)
{
}
/// <summary>
/// Gets the worker host path.
/// </summary>
/// <param name="job">
/// The job.
/// </param>
/// <param name="workUnit">
/// The work unit.
/// </param>
/// <param name="workerSettings">
/// The worker settings.
/// </param>
/// <returns>
/// The worker host path for submission to the work processor.
/// </returns>
protected override string GetWorkerHostPath(Job job, WorkUnit workUnit, FlowModelWorkerSettings workerSettings)
{
// TODO: Define your worker host application package environment variable name, e.g. AZ_BATCH_APP_PACKAGE_XXXXXX.
const string workerHostPathEnvVarName = "AZ_BATCH_APP_PACKAGE_XXXXXX";
const string workerHostFileName = "DNVGL.One.Compute.WorkerHost.AzureBatch.exe";
return $@"cmd /c %{workerHostPathEnvVarName}%\{workerHostFileName}";
}
}
}