[英]Azure Batch - Task competes but does nothing
I'm trying to run a task on Azure Batch pool.我正在尝试在 Azure Batch 池上运行任务。 The task completes with no errors, but produces no output.任务完成时没有错误,但不产生任何输出。
I created and configured Ubuntu 18.04 LTS virtual machine, put my .NET Core 2.1 SCA into /usr/local/bin/MyApp
and created image from this machine.我创建并配置了 Ubuntu 18.04 LTS 虚拟机,将我的 .NET Core 2.1 SCA 放入/usr/local/bin/MyApp
并从这台机器创建了映像。
Next, i create the batch pool with my custom image and one low-priority node.接下来,我使用我的自定义图像和一个低优先级节点创建批处理池。
When i ssh to it, i can see my application where i put it and can run it as follows:当我 ssh 到它时,我可以看到我放置它的应用程序并可以按如下方式运行它:
cd /usr/local/bin/MyApp && ./MyApp some_param
This produces the expected result.这会产生预期的结果。 But when i create the task in azure portal:但是当我在 azure 门户中创建任务时:
/bin/sh -c cd /usr/local/bin/MyApp && ./MyApp some_param
it runs less then 1s and shows that the task succeeded.它运行不到 1s 并显示任务成功。 But it does not produce any result.但它不会产生任何结果。
My application simply loads file from blob storage, processes it and uploads back to the blob storage.我的应用程序只是从 blob 存储加载文件,处理它并上传回 blob 存储。
When i run the following task in portal:当我在门户中运行以下任务时:
/bin/sh -c pwd
it outputs:它输出:
/mnt/batch/tasks/workitems/processing-job/job-1/test2/wd
But when i do this:但是当我这样做时:
/bin/sh -c cd .. && pwd
i see nothing in stderr.txt
and stdout.txt
.我在stderr.txt
和stdout.txt
什么也没看到。
Can it be that it simply can't find my application (and does not throw any errors for some reason)?是不是它根本找不到我的应用程序(并且由于某种原因没有抛出任何错误)?
I tried adding MyApp to $PATH, but then when i run:我尝试将 MyApp 添加到 $PATH,但是当我运行时:
MyApp some_param
in stderr.txt
i see access denied error.在stderr.txt
我看到拒绝访问错误。
I tried executing it under admin and non-admin users with the same result.我尝试在管理员和非管理员用户下执行它,结果相同。
Please help.请帮忙。
Cool, so here is the quick answer and hope this caters your need:很酷,所以这里是快速答案,希望这能满足您的需求:
For multiple command failure see this: Azure batch - run multiple commands from command line on linux VM对于多个命令失败,请参阅: Azure 批处理 - 在 linux VM 上从命令行运行多个命令
ie try this in your command line /bin/bash -c "cd .. && pwd"
即在您的命令行中尝试此操作/bin/bash -c "cd .. && pwd"
$AZ_BATCH_TASK_DIR
sample code is there or you can experiment as well.另请注意,如果您不知道它已经在此处查看,则会为已知工作目录位置填充环境变量: https : //docs.microsoft.com/en-us/azure/batch/batch-计算节点环境变量,您可以使用这些环境变量,例如$AZ_BATCH_TASK_DIR
示例代码在那里,或者您也可以进行实验。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.