无法使用任务在azure批处理池中执行python文件。错误:找不到指定的命令程序

问题描述 投票:0回答:1

目标是使用azure批处理作业执行存储在blob存储中的python文件。

-- 创建了 azure 帐户 -- 创建池 -- 创造就业机会 -- 创建任务

批处理池:

windowsserver
Target Dedicated Nodes: 2
VM Size: Standard A1_V2  1vCPU 2Gb Memory
StartTask: installs python by taking .exe files from storage account

任务: 使用存储在 blob 存储中的 python 文件,只需简单地打印“Hello World”。

输出:给出错误消息:系统找不到指定的文件。

通过远程登录到批处理节点,我能够确认 python 已安装。

我做错了什么?

也许“命令行”中执行python脚本的语法不正确?

我不知道如何提供环境变量。

azure batch-processing azure-batch
1个回答
0
投票

为了在 Azure 批处理池 Windows 节点中作为启动任务运行 Python 脚本,请参阅此 Microsoft 博客中的步骤。

我从这个

网站
下载了Python 3.12,并在我的存储帐户容器中上传了下载的exe包,如下所示:-

使用

Windows Server 2019 datacenter

 创建了一个批处理池,具有 3 个节点和 1 个 Spot 节点[您也可以使用 1 个节点创建它]。

在启动任务中,从

存储帐户中选择exe包:-

将 exe 包从存储帐户上传到批处理任务时,请确保

check-mark Include SAS

:-

enter image description here

enter image description here

我的任务:-

enter image description here

命令行

脚本 安装 Python 3.12:-

cmd /c "python-3.12.0-amd64.exe /quiet InstallAllUsers=1 PrependPath=1 Include_test=0"

海拔级别中选择池自动用户、管理员

保存任务,任务在节点上运行成功:-

enter image description here

我通过 Rdp 进入节点,

Python 3.12 已成功安装:-

enter image description here

现在,我在我的

存储帐户中添加了另一个hello_world.py,并使用包含SAS复选标记并将其ran放入节点中:-

在批量启动任务>资源文件中添加了hello_world.py

:-

enter image description here

我的开始任务:-

命令行:-

cmd /c "python-3.12.0-amd64.exe /quiet InstallAllUsers=1 PrependPath=1 Include_test=0" cmd /c "python hello_world.py"

enter image description here

启动任务已成功运行,

确保每次运行启动任务之前都重新启动节点。

enter image description here

我通过 RDP 连接到节点,文件已成功呈现:-

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.