Disable Scheduled pipeline endpoint

Emilio Gagliardi 26 Reputation points
2021-04-15T03:28:19.767+00:00

Hi there,

I am following the microsoft learn tutorials, and one of them had us publish a pipeline with a schedule.

recurrence = ScheduleRecurrence(frequency="Week", interval=1, week_days=["Monday"], time_of_day="00:00")
weekly_schedule = Schedule.create(ws, name="weekly-diabetes-training",
description="Based on time",
pipeline_id=published_pipeline.id,
experiment_name='mslearn-diabetes-pipeline',
recurrence=recurrence)

Now I'd like to delete that pipeline, but when I try to delete it in the Pipelines > Pipeline Endpoints section, I get an error saying that a pipeline with a schedule cannot be disabled.

There is no code provided to remove or delete the schedule. Can anyone provide the python code necessary to remove the schedule from the pipeline so I can delete it?

Thank you kindly,

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

1 answer

Sort by: Most helpful
  1. Matteo Beshara 6 Reputation points
    2021-08-23T09:36:05.567+00:00

    The solution is:

    from azureml.pipeline.core import Schedule
    import azureml.core
    from azureml.core import Workspace
    
    # Load the workspace from the saved config file
    ws = Workspace.from_config()
    sch = Schedule.list(ws)[0] # I want to disable the first pipeline
    
    Schedule.disable(sch)
    
    1 person found this answer helpful.