azure-sdk-for-python icon indicating copy to clipboard operation
azure-sdk-for-python copied to clipboard

Failed to read in local execute job - Missing positional argument for HttpRequest when submitting job on local compute

Open amrsharaf opened this issue 2 years ago • 1 comments

  • Package Name: azure-ai-ml
  • Package Version: 1.2.0
  • Operating System: MacOS Ventura 13.1
  • Python Version: 3.8.15

Describe the bug

I'm trying to run a simple AML job on my local compute, the job fails, with the error: Failed to read in local execute job. Upon further debugging, I found that the error was in this line:

https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_local_job_invoker.py#L149

response = requests_pipeline.post(url=url, json=body, headers={"Authorization": "Bearer " + token})

The fix would be using a positional rather than a keyword argument like this:

response = requests_pipeline.post(url, json=body, headers={"Authorization": "Bearer " + token})

To Reproduce

Run the following code:

#import required libraries
from azure.ai.ml import MLClient, command
from azure.ai.ml.entities import Environment
from azure.identity import DefaultAzureCredential

#connect to the workspace
ml_client = MLClient.from_config(DefaultAzureCredential())

# set up pytorch environment
env = Environment(
    image='mcr.microsoft.com/azureml/openmpi3.1.2-ubuntu18.04',
    name='pytorch-env'
)

# define the command
command_job = command(
    command='echo hi',
    environment=env,
    compute='local',
)

returned_job = ml_client.jobs.create_or_update(command_job)
print(returned_job)

Expected behavior

Job on local compute should run and finish successfully. Even after fixing this bug, my local job still failed due to docker registry authentication failure, I fixed that too by using default values for username and password, but I'll open another issue / ticket for this. The job would still fail though due to an error in executing the vm bootstrapper. It would be really helpful if someone can provide a running version of the code for submitting a job on local compute, I can only fine sdk v1 examples.

amrsharaf avatar Jan 03 '23 18:01 amrsharaf

Thanks for the feedback. Can someone from @azureml-github take a look?

pvaneck avatar Jan 03 '23 21:01 pvaneck

I'm hitting this as well.

jacobdanovitch avatar Jan 05 '23 20:01 jacobdanovitch

I am facing the same issue. Can't execute command job in local

mazumdarabhinav avatar Jan 18 '23 08:01 mazumdarabhinav

Same issue

TimbusCalin avatar Feb 02 '23 13:02 TimbusCalin

Any updates on this?

kamilpz avatar Feb 21 '23 14:02 kamilpz

Any updates on this please, as have same issue?

corticalstack avatar Mar 03 '23 11:03 corticalstack

I have the same issue. Would be really nice if this could be fixed soon.

vaaale avatar Mar 08 '23 19:03 vaaale

Any update please?

corticalstack avatar Mar 15 '23 07:03 corticalstack

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @azureml-github, @Azure/azure-ml-sdk.

Issue Details
  • Package Name: azure-ai-ml
  • Package Version: 1.2.0
  • Operating System: MacOS Ventura 13.1
  • Python Version: 3.8.15

Describe the bug

I'm trying to run a simple AML job on my local compute, the job fails, with the error: Failed to read in local execute job. Upon further debugging, I found that the error was in this line:

https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_local_job_invoker.py#L149

response = requests_pipeline.post(url=url, json=body, headers={"Authorization": "Bearer " + token})

The fix would be using a positional rather than a keyword argument like this:

response = requests_pipeline.post(url, json=body, headers={"Authorization": "Bearer " + token})

To Reproduce

Run the following code:

#import required libraries
from azure.ai.ml import MLClient, command
from azure.ai.ml.entities import Environment
from azure.identity import DefaultAzureCredential

#connect to the workspace
ml_client = MLClient.from_config(DefaultAzureCredential())

# set up pytorch environment
env = Environment(
    image='mcr.microsoft.com/azureml/openmpi3.1.2-ubuntu18.04',
    name='pytorch-env'
)

# define the command
command_job = command(
    command='echo hi',
    environment=env,
    compute='local',
)

returned_job = ml_client.jobs.create_or_update(command_job)
print(returned_job)

Expected behavior

Job on local compute should run and finish successfully. Even after fixing this bug, my local job still failed due to docker registry authentication failure, I fixed that too by using default values for username and password, but I'll open another issue / ticket for this. The job would still fail though due to an error in executing the vm bootstrapper. It would be really helpful if someone can provide a running version of the code for submitting a job on local compute, I can only fine sdk v1 examples.

Author: amrsharaf
Assignees: luigiw
Labels:

question, Machine Learning, Service Attention, customer-reported

Milestone: -

ghost avatar Apr 03 '23 19:04 ghost

Do you happen to have any updates on this?

ghost avatar Jul 31 '23 20:07 ghost

Hi everyone, sorry for the lack of updates on this one. A PR was recently merged to main to address this: #31285. It will be included in the next release.

diondrapeck avatar Jul 31 '23 20:07 diondrapeck

Hi @amrsharaf. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text "/unresolve" to remove the "issue-addressed" label and continue the conversation.

github-actions[bot] avatar Aug 18 '23 16:08 github-actions[bot]

Hi @amrsharaf, since you haven’t asked that we /unresolve the issue, we’ll close this out. If you believe further discussion is needed, please add a comment /unresolve to reopen the issue.

github-actions[bot] avatar Aug 25 '23 16:08 github-actions[bot]