azure - 获取 Azure Batch 批处理帐户可用的应用程序包列表
问题描述
我正在制作一个启动批处理的 python 应用程序。我想通过用户输入创建一个池。为简单起见,我只是将批处理帐户中存在的所有应用程序添加到池中。我无法获得可用应用程序包的列表。这是代码的一部分:
import azure.batch.batch_service_client as batch
from azure.common.credentials import ServicePrincipalCredentials
credentials = ServicePrincipalCredentials(
client_id='xxxxx',
secret='xxxxx',
tenant='xxxx',
resource="https://batch.core.windows.net/"
)
batch_client = batch.BatchServiceClient(
credentials,
base_url=self.AppData['CloudSettings'][0]['BatchAccountURL'])
# Get list of applications
batchApps = batch_client.application.list()
我可以创建一个池,所以凭据很好并且有应用程序,但返回的列表是空的。有人可以帮我吗?
谢谢你,圭多
更新:
我试过:
import azure.batch.batch_service_client as batch
batchApps = batch.ApplicationOperations.list(batch_client)
和
import azure.batch.operations as batch_operations
batchApps = batch_operations.ApplicationOperations.list(batch_client)
但它们似乎不起作用。batchApps 始终为空。我认为这不是身份验证问题,否则我会收到错误消息。此时我想知道它是否只是python SDK中的一个错误?
我使用的 SDK 版本是:
天蓝色批次:4.1.3
天蓝色:4.0.0
这是空的 batchApps var 的屏幕截图:
解决方案
这是您要查找的链接吗:
在这里了解应用程序包的概念:https ://docs.microsoft.com/en-us/azure/batch/batch-application-packages
因为它的python SDK在这里起作用:https ://docs.microsoft.com/en-us/python/api/azure-batch/azure.batch.operations.applicationoperations?view=azure-python
希望这可以帮助。
推荐阅读
- excel - 如何使用变量输入在宏中编辑公式栏?
- python - 从今天的日期到“n”周前提取大块 Pandas 数据框
- sql - Sql 加入字段但首先通过分隔符拆分值并仅使用部分
- android - 用于单例模型的 Android Kotlin 对象与 Dagger2
- image - Docker 容器在底层镜像被删除后启动,这怎么可能?
- python - 如何在 SQL Server 上安装自写库
- python - 图表断开:无法获取张量的值 Tensor("conv2d_1_input:0", shape=(?, 128, 128, 1), dtype=float32)
- flutter - Flutter中网页的JSON发生变化时如何通知用户?
- vue.js - Vue计算方法无法使用模板中的setter更改数据
- sql - 如何使用排名获取最新的奖金记录