Skip to main content
Version: 1.40

Job schedules

You can manage job schedules using the Python client.

Create a job schedule

from deeploy import CreateJobSchedule
from deeploy.enums import Endpoint

create_options: CreateJobSchedule = {
"name": "A unique name",
"cron_expression": "0 9-17 * * 1-5", # Every hour from 9 through 17 on every working day (UTC)
"endpoint": Endpoint.EXPLAIN,
"deployment_id": "b6d8c781-2526-4e03-9b43-4c1a62d064db",
}

job_schedule = client.create_job_schedule(create_options)

Test a job schedule

from deeploy import TestJobSchedule
from deeploy.enums import Endpoint

test_options: TestJobSchedule = {
"endpoint": Endpoint.PREDICT,
"deployment_id": "b6d8c781-2526-4e03-9b43-4c1a62d064db",
}

predictions = client.test_job_schedule(test_options)

Update a job schedule

from deeploy import UpdateJobSchedule

update_options: UpdateJobSchedule = {
"name": "New unique name",
"cron_expression": "0 * * * *", # Every hour
"endpoint": Endpoint.EXPLAIN,
"deployment_id": "b6d8c781-2526-4e03-9b43-4c1a62d064db",
}

job_schedule = client.update_job_schedule(update_options)

Deactivate a job schedule

job_schedule = client.deactivate_job_schedule(job_schedule_id)

Activate a job schedule

job_schedule = client.activate_job_schedule(job_schedule_id)