Skip to main content
A newer release of this product is available.

Cluster schedules endpoint overview

Contributors

Overview

You can use the /cluster/schedules API to view, create, and modify job schedules in a cluster.

Retrieving a job schedule

You can retrieve job schedules by issuing a GET request to /cluster/schedules. It is also possible to retrieve a specific schedule when qualified by its UUID to /cluster/schedules/{uuid}. You can apply queries on fields to retrieve all schedules that match the combined query.

Example

# The API:
/api/cluster/schedules/

# The call:
curl -X GET 'https://<mgmt-ip>/api/cluster/schedules?type=interval'

# The response:
{
"records": [
  {
    "uuid": "08ceae53-0158-11e9-a82c-005056bb4301",
    "name": "RepositoryBalanceMonitorJobSchedule",
    "type": "interval",
    "interval": "PT10M",
    "_links": {
      "self": {
        "href": "/api/cluster/schedules/08ceae53-0158-11e9-a82c-005056bb4301"
      }
    }
  },
  {
    "uuid": "0941e980-0158-11e9-a82c-005056bb4301",
    "name": "Balanced Placement Model Cache Update",
    "type": "interval",
    "interval": "PT7M30S",
    "_links": {
      "self": {
        "href": "/api/cluster/schedules/0941e980-0158-11e9-a82c-005056bb4301"
      }
    }
  },
  {
    "uuid": "0944b975-0158-11e9-a82c-005056bb4301",
    "name": "Auto Balance Aggregate Scheduler",
    "type": "interval",
    "interval": "PT1H",
    "_links": {
      "self": {
        "href": "/api/cluster/schedules/0944b975-0158-11e9-a82c-005056bb4301"
      }
    }
  },
  {
    "uuid": "0c65f1fb-0158-11e9-a82c-005056bb4301",
    "name": "Application Templates ASUP Dump",
    "type": "interval",
    "interval": "P1D",
    "_links": {
      "self": {
        "href": "/api/cluster/schedules/0c65f1fb-0158-11e9-a82c-005056bb4301"
      }
    }
  }
],
"num_records": 4,
"_links": {
  "self": {
    "href": "/api/cluster/schedules?type=interval"
  }
}
}
# The API:
/api/cluster/schedules/{uuid}

# The call:
curl -X GET 'https://<mgmt-ip>/api/cluster/schedules/25312bd8-0158-11e9-a82c-005056bb4301'

# The response:
{
"uuid": "25312bd8-0158-11e9-a82c-005056bb4301",
"name": "monthly",
"cluster": {
  "name": "rodan-tsundere",
  "uuid": "f3f9bbfa-0157-11e9-a82c-005056bb4301"
},
"type": "cron",
"cron": {
  "minutes": [
    20
  ],
  "hours": [
    0
  ],
  "days": [
    1
  ]
},
"_links": {
  "self": {
    "href": "/api/cluster/schedules/25312bd8-0158-11e9-a82c-005056bb4301"
  }
}
}

Creating a job schedule

You can create a job schedule by issuing a POST request to /cluster/schedules to a node in the cluster. For a successful request, the POST request returns a status code of 201. Job schedules can be of either type "cron" or type "interval". A cron schedule is run at specific minutes within the hour, or hours of the day, days of the week, days of the month, or months of the year. An interval schedule runs repeatedly at fixed intervals.

Required fields

  • name - Name of the job schedule You are required to provide a "minutes" field for a cron schedule. An "interval" field is required for an interval schedule. Do not provide both a "cron" field and an "interval" field. The schedule UUID is created by the system.

Cron schedule fields

  • cron.minutes - Minutes within the hour (0 through 59)

  • cron.hours - Hours of the day (0 through 23)

  • cron.weekdays - Weekdays (0 through 6, where 0 is Sunday and 6 is Saturday.)

  • cron.days - Days of the month (1 through 31)

  • cron.months - Months of the year (1 through 12)

Interval schedule field

  • interval - Length of time in ISO 8601 duration format.

Examples

Create an interval schedule with a 1-week interval

# The API:
/api/cluster/schedules
one_week_interval.txt:
{
  "name": "test_interval_1",
  "interval": "P1W"
}

# The call:
curl -X POST "https://<mgmt-ip>/api/cluster/schedules" -d "@one_week_interval.txt"

# The response of a successful POST is empty.

Create a cron schedule that runs daily at 12:05

# The API:
/api/cluster/schedules
daily_noon_job.txt:
{
  "name": "test_cron_1",
  "cron":
  {
      "minutes": [ 5 ],
      "hours": [ 12 ]
  }
}

# The call:
curl -X POST "https://<mgmt-ip>/api/cluster/schedules" -d "@daily_noon_job.txt"

# The response of a successful POST is empty.

Optional fields

By default, the schedule is owned by the local cluster. In a MetroCluster configuration, you can specify the partner cluster if the local cluster is in the switchover state.

  • cluster.name - Name of the cluster owning the schedule.

  • cluster.uuid - UUID of the cluster owning the schedule.

Records field

You can create multiple schedules in one request by providing an array of named records with schedule entries. Each entry must follow the required and optional fields listed above.


Updating a job schedule

The following fields of an existing schedule can be modified:

  • cron.minutes

  • cron.hours

  • cron.weekdays

  • cron.days

  • cron.months

  • interval Note that you cannot modify the name, cluster, and type of schedule. Also, you cannot modify a cron field of an interval schedule, or the interval field of a cron schedule. You can apply queries on fields to modify all schedules that match the combined query.

Examples

Modify an interval schedule with a 2-day and 5-minute interval

# The API:
/api/cluster/schedules/{uuid}
every_two_days_five_minutes.txt:
{
  "interval": "P2DT5M"
}

# The call:
curl  -X PATCH "https://<mgmt-ip>/api/cluster/schedules/{uuid}" -d "@every_two_days_five_minutes.txt"

# The response of a sucessful PATCH is empty.

Modify a cron schedule to run Mondays at 2

# The API:
/api/cluster/schedules/{uuid}
monday_at_two.txt:
{
  "cron":
  {
      "hours": [ 2 ],
      "weekdays": [ 1 ]
  }
}

# The call:
curl  -X PATCH "https://<mgmt-ip>/api/cluster/schedules/{uuid}" -d "@monday_at_two.txt"

# The response of a sucessful PATCH is empty.

Deleting a job schedule

You can delete job schedules based on their UUID. You can apply queries on fields to delete all schedules that match the combined query.

Example

# The API:
/api/cluster/schedules/{uuid}

# The call:
curl -X DELETE "https://<mgmt-ip>/api/cluster/schedules/{uuid}"

# The response of a successful DELETE of one schedule is empty.
# The API:
/api/cluster/schedules/

# The call:
curl -X DELETE "https://<mgmt-ip>/api/cluster/schedules/?name=test*"

# The response of a successful DELETE indicates the number of schedules affected:
{
"num_records": 2,
"_links": {
  "self": {
    "href": "/api/cluster/schedules?name=test*"
  }
}
}

MetroCluster configurations

In a MetroCluster configuration, user-created schedules owned by the local cluster are replicated to the partner cluster. Likewise, user-created schedules owned by the partner cluster are replicated to the local cluster. The owning cluster for a particular schedule is shown in the "cluster.name" and "cluster.uuid" fields. Normally, only schedules owned by the local cluster can be created, modified, and deleted on the local cluster. However, when a MetroCluster configuration is in switchover, the cluster in switchover state can create, modify, and delete schedules owned by the partner cluster.