问题描述
我正在尝试通过以下方式使用 python API 与 Azure Batch 交互:
from azure.batch import BatchServiceClient
batch = BatchServiceClient('<mycredential>','https://<mybatchaccount>.<region>.batch.azure.com')
next(batch.job.list())
这是在 ML Studio notebook 中运行的。
但是出现以下错误:AttributeError: 'str' object has no attribute 'signed_session'
.
我正在从我的批处理控制台 UI 中获取 url 和凭据:
作为凭证,我尝试了主要和次要访问键以及“URL”作为批处理 url。
我做错了什么吗?
谢谢
解决方法
<mycredential>
不应该是您的裸身份验证密钥字符串。您需要创建一个共享的身份验证密钥对象。
credentials = batchauth.SharedKeyCredentials(BATCH_ACCOUNT_NAME,BATCH_ACCOUNT_KEY)
batch_client = batch.BatchServiceClient(credentials,base_url=BATCH_ACCOUNT_URL)