create_schedule

SchedulesApi.create_schedule(role_id, create_schedule_request, _request_timeout=None, _request_auth=None, _content_type=None, _headers=None, _host_index=0)

Create a schedule

Creates a job/event/external-trigger schedule, or a notebook datalab schedule when ResourceType is sagemaker-notebook. Common job schedule types: time, event, none. Also supports event-trigger and external-trigger. Returns ScheduleId on success.

Parameters:
  • role_id (str) – Amorphic role ID used for authorization. (required)

  • create_schedule_request (CreateScheduleRequest) – Create body for job/event/external-trigger schedules, or notebook datalab schedules when ResourceType is sagemaker-notebook. (required)

  • _request_timeout (int, tuple(int, int), optional) – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.

  • _request_auth (dict, optional) – set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.

  • _content_type (str, Optional) – force content-type for the request.

  • _headers (dict, optional) – set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.

  • _host_index (int, optional) – set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.

Return type:

ScheduleId

Returns:

Returns the result object.

Request and Response Examples

HTTP: POST /schedules/schedule

Parameter examples

Name

In

Example

role_id

header

"role-admin"

Request

Create body for job/event/external-trigger schedules, or notebook datalab schedules when `ResourceType` is `sagemaker-notebook`.

Time-based ETL schedule

{
  "JobName": "nightly-etl",
  "Description": "Nightly ETL run",
  "ScheduleType": "time",
  "ScheduleParam": {
    "ScheduleExpression": "cron(0 2 * * ? *)"
  },
  "JobType": "etl",
  "Resource": "my-etl-job",
  "Arguments": [],
  "Keywords": []
}

On-demand schedule

{
  "JobName": "on-demand-ingest",
  "Description": "Manual ingestion schedule",
  "ScheduleType": "none",
  "ScheduleParam": {},
  "JobType": "ingestion",
  "Resource": "dataset-aaaa-bbbb-cccc-dddd",
  "Arguments": []
}

Success (HTTP 200)

Schedule created. Body includes `ScheduleId` and `Message`.

jobScheduleCreated

{
  "ScheduleId": "sch-11111111-aaaa-bbbb-cccc-222222222222",
  "Message": "Successfully created the schedule."
}

datalabScheduleCreated

{
  "ScheduleId": "nbs-aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
  "Message": "Successfully created notebook schedule"
}

Errors

Documented error codes: IPV-1041, IPV-1018.

HTTP 400

Validation or authorization failure

invalidScheduleType

{
  "Message": "IPV-1041 - Invalid value for parameter - ScheduleType"
}

duplicateName

{
  "Message": "IPV-1018 - Schedule Name already exists"
}

HTTP 500

Unexpected server error while creating the schedule.