Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task scheduling API #25

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions rmf_api_msgs/schemas/task_schedule.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://raw.githubusercontent.com/open-rmf/rmf_api_msgs/main/rmf_api_msgs/schemas/task_schedule.json",
"title": "Task Schedule",
"description": "Describe a task schedule",
"type": "object",
"properties": {
"name": {
"description": "Name for the scheduled task",
"type": "string"
},
"schedule": {
"description": "Schedule for the task, format following the cron string standard",
"type": "string"
},
"unix_millis_start_at": {
"description": "(Optional) Timestamp in unix epoch milliseconds, at which the schedule should start, will be set to now if undefined",
"type": "integer"
},
"unix_millis_finish_at": {
"description": "(Optional) Timestamp in unix epoch milliseconds, at which the schedule should end. Will be ending at int64 wrap time if undefined.",
"type": "integer"
},
"request": { "$ref": "task_request.json" }
},
"required": ["name", "schedule", "unix_millis_start_at", "unix_millis_finish_at", "request"]
}
16 changes: 16 additions & 0 deletions rmf_api_msgs/schemas/task_schedule_add_request.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://raw.githubusercontent.com/open-rmf/rmf_api_msgs/main/rmf_api_msgs/schemas/task_schedule_add_request.json",
"title": "Add Task Schedule Request",
"description": "Request a task to be executed at a fixed schedule",
"type": "object",
"properties": {
"type": {
"description": "Indicate that this is a task schedule add request",
"type": "string",
"constant": "task_schedule_add_request"
},
"schedule": { "$ref": "task_schedule.json" }
},
"required": ["type", "schedule"]
}
33 changes: 33 additions & 0 deletions rmf_api_msgs/schemas/task_schedule_add_response.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://raw.githubusercontent.com/open-rmf/rmf_api_msgs/main/rmf_api_msgs/schemas/task_schedule_add_response.json",
"title": "Add Task Schedule Response",
"description": "Response to a task schedule creation request",
"type": "object",
"oneOf": [
{
"properties": {
"success": { "type": "boolean", "enum": [true] },
"name": {
"description": "Name assigned to the task schedule",
"type": "string" }
},
"required": ["success", "name"]
},
{
"properties": {
"success": { "type": "boolean", "enum": [false] },
"name": {
"description": "Name assigned to the task schedule",
"type": "string" },
"errors": {
"description": "Any error messages explaining why the request failed",
"type": "array",
"items": { "$ref": "error.json" }
}
},
"required": ["success", "errors", "name"]
}
]
}

15 changes: 15 additions & 0 deletions rmf_api_msgs/schemas/task_schedule_list_request.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://raw.githubusercontent.com/open-rmf/rmf_api_msgs/main/rmf_api_msgs/schemas/task_schedule_list_request.json",
"title": "List Task Schedules Request",
"description": "Request a list of scheduled tasks",
"type": "object",
"properties": {
"type": {
"description": "Indicate that this is a task schedule list request",
"type": "string",
"constant": "task_schedule_list_request"
}
},
"required": ["type"]
}
30 changes: 30 additions & 0 deletions rmf_api_msgs/schemas/task_schedule_list_response.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://raw.githubusercontent.com/open-rmf/rmf_api_msgs/main/rmf_api_msgs/schemas/task_schedule_list_response.json",
"title": "List Task Schedules Response",
"description": "Response with a list of scheduled tasks",
"type": "object",
"properties": {
"type": {
"description": "Indicate that this is a task schedule list response",
"type": "string",
"constant": "task_schedule_list_response"
},
"schedules": {
"description": "List of task schedules with their state",
"type": "array",
"items": {
"scheduled_task": { "$ref": "task_schedule.json" },
"state": {
"description": "State of the schedule",
"type": "string",
"enum": ["created", "started", "finished", "cancelled", "failed"]
},
"unix_millis_last_modified": { "type": "integer"},
"unix_millis_last_ran": { "type": "integer"},
"unix_millis_next_run": { "type": "integer"}
}
}
},
"required": ["type", "schedule"]
}
20 changes: 20 additions & 0 deletions rmf_api_msgs/schemas/task_schedule_remove_request.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://raw.githubusercontent.com/open-rmf/rmf_api_msgs/main/rmf_api_msgs/schemas/task_schedule_remove_request.json",
"title": "Add Task Schedule Request",
"description": "Request a task to be executed at a fixed schedule",
"type": "object",
"properties": {
"type": {
"description": "Indicate that this is a task schedule remove request",
"type": "string",
"constant": "task_schedule_remove_request"
},
"name": {
"description": "Name for the scheduled task to be removed",
"type": "string"
}
},
"required": ["name"]
}

34 changes: 34 additions & 0 deletions rmf_api_msgs/schemas/task_schedule_remove_response.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://raw.githubusercontent.com/open-rmf/rmf_api_msgs/main/rmf_api_msgs/schemas/task_schedule_remove_response.json",
"title": "Remove Task Schedule Response",
"description": "Response to a task schedule removal request",
"type": "object",
"oneOf": [
{
"properties": {
"success": { "type": "boolean", "enum": [true] },
"name": {
"description": "Name assigned to the task schedule",
"type": "string" }
},
"required": ["success", "name"]
},
{
"properties": {
"success": { "type": "boolean", "enum": [false] },
"name": {
"description": "Name assigned to the task schedule",
"type": "string" },
"errors": {
"description": "Any error messages explaining why the request failed",
"type": "array",
"items": { "$ref": "error.json" }
}
},
"required": ["success", "errors", "name"]
}
]
}