Avoid scheduled pipeline to be triggered immediately after creation in azureml (Python SDK v2)

Jaume Amores 5 Reputation points
2025-10-01T17:30:37.03+00:00

When I submit a pipeline with an associated schedule, it runs immediately after submission, instead of waiting until the scheduled time of the day, day of the month, etc. Is there a way to avoid this programmatically using Python SDK v2?

Azure Machine Learning
{count} votes

1 answer

Sort by: Most helpful
  1. Anshika Varshney 1,910 Reputation points Microsoft External Staff Moderator
    2025-10-01T18:26:40+00:00

    Hello Jaume Amores,

    Thank you for reaching out on the Microsoft Q&A.

    By default, when u create a schedule for a pipeline in Azure Machine Learning, it triggers right away if u don’t specify a start time.

    To avoid this, u can set the start_time parameter to a future datetime when creating the schedule. This way, the pipeline won’t run immediately after creation but will only start at the time you define.

    Here is a example (Python SDK v2):

    from datetime import datetime, timedelta
    from azure.ai.ml.entities import CronTrigger, Schedule
    
    # set start time in the future (e.g., 1 day later)
    start_time = datetime.utcnow() + timedelta(days=1)
    
    trigger = CronTrigger(
        expression="0 14 * * *",   # everyday at 2 PM UTC
        start_time=start_time
    )
    
    schedule = Schedule(
        name="test_schedule",
        trigger=trigger,
        create_job=your_pipeline_job  # your pipeline job reference here
    )
    
    ml_client.schedules.create_or_update(schedule)
    
    

    This way, the schedule will only become active at the specified start_time instead of running right after creation.

    References:

    I Hope this helps. Do let me know if you have any further queries.

    Thankyou!

    1 person found this answer helpful.
    0 comments No comments

Your answer

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