3nomis
3nomis

Reputation: 1613

Azure Batch API rising 'AttributeError' in ML notebook

I am trying to interact with Azure Batch with python API, in the following way:

from azure.batch import BatchServiceClient
batch = BatchServiceClient('<mycredential>','https://<mybatchaccount>.<region>.batch.azure.com')
next(batch.job.list())

This is run in a ML Studio notebook.

However the following error appears: AttributeError: 'str' object has no attribute 'signed_session'.
I am taking the url and credentials from my batch console UI:

enter image description here

As a credential I tried both Primary and Secondary access keys amd "URL" as batch url.
Am I doing anything wrong?
Thanks

Upvotes: 0

Views: 74

Answers (1)

fpark
fpark

Reputation: 2369

<mycredential> should not be your bare auth key string. You need to create a shared auth key object.

credentials = batchauth.SharedKeyCredentials(BATCH_ACCOUNT_NAME, BATCH_ACCOUNT_KEY)
batch_client = batch.BatchServiceClient(credentials, base_url=BATCH_ACCOUNT_URL)

Please see the Azure Batch Python tutorial.

Upvotes: 1

Related Questions