cancel local run in azureml sdk2

sara rezaei 20 Reputation points
2023-09-23T06:48:11.89+00:00

This code is creating a local run with sdk2, and I want to cancel this job, how can I do this?

#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',
    conda_file='pytorch-env.yml',
    name='pytorch-env'
)

# define the command
command_job = command(
    code='./src',
    command='train.py',
    environment=env,
    compute='local',
)

returned_job = ml_client.jobs.create_or_update(command_job)
returned_job

Azure Machine Learning
Azure Machine Learning
An Azure machine learning service for building and deploying models.
2,838 questions
{count} votes

Accepted answer
  1. romungi-MSFT 44,671 Reputation points Microsoft Employee
    2023-09-25T13:10:35.33+00:00

    @sara rezaei Are you using local compute in this case? With local compute I think the cancel operation is not supported.

    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.