【发布时间】:2021-10-13 21:10:55
【问题描述】:
这是我尝试从微软教程 here 和 here 创建的 Azure 批处理配置
我正在尝试定义环境变量here
CloudPool pool = batchClient.PoolOperations.CreatePool(
poolId: PoolId,
targetDedicatedComputeNodes: PoolNodeCount,
virtualMachineSize: PoolVMSize,
virtualMachineConfiguration: vmConfiguration);
// Specify the application and version to install on the compute nodes
pool.ApplicationPackageReferences = new List<ApplicationPackageReference>
{
new ApplicationPackageReference {
ApplicationId = "7Zip",
Version = "19.00" }
};
// Commit the pool so that it's created in the Batch service. As the nodes join
// the pool, the specified application package is installed on each.
await pool.CommitAsync();
CloudJob job = batchClient.JobOperations.CreateJob();
job.Id = JobId;
job.PoolInformation = new PoolInformation { PoolId = PoolId };
await job.CommitAsync();
string taskId = "blendertask01";
string commandLine =
@"cmd /c echo %AZ_BATCH_APP_PACKAGE_7Zip%";
CloudTask blenderTask = new CloudTask(taskId, commandLine);
batchClient.JobOperations.AddTask(JobId, blenderTask);
我期待cmd /c echo %AZ_BATCH_APP_PACKAGE_7Zip% 的输出为我提供可以找到我的应用程序 7zip 的路径,以便我可以安装它,但我不明白。
相反,我得到%AZ_BATCH_APP_PACKAGE_7Zip%
【问题讨论】:
标签: azure azure-batch