From 844a0d4a9fbad8f1b3fb50e8716465f9fa3e628a Mon Sep 17 00:00:00 2001 From: Luca Della Vedova Date: Tue, 21 Jun 2022 20:01:49 +0800 Subject: [PATCH 1/5] Draft of task scheduling API Signed-off-by: Luca Della Vedova --- .../schemas/task_schedule_add_request.json | 24 +++++++++++++ .../schemas/task_schedule_add_response.json | 33 ++++++++++++++++++ .../schemas/task_schedule_remove_request.json | 20 +++++++++++ .../task_schedule_remove_response.json | 34 +++++++++++++++++++ 4 files changed, 111 insertions(+) create mode 100644 rmf_api_msgs/schemas/task_schedule_add_request.json create mode 100644 rmf_api_msgs/schemas/task_schedule_add_response.json create mode 100644 rmf_api_msgs/schemas/task_schedule_remove_request.json create mode 100644 rmf_api_msgs/schemas/task_schedule_remove_response.json diff --git a/rmf_api_msgs/schemas/task_schedule_add_request.json b/rmf_api_msgs/schemas/task_schedule_add_request.json new file mode 100644 index 0000000..92006c3 --- /dev/null +++ b/rmf_api_msgs/schemas/task_schedule_add_request.json @@ -0,0 +1,24 @@ +{ + "$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" + }, + "name": { + "description": "(Optional) Name for the scheduled task, if a task with this name already exists the schedule will be updated. Will be autogenerated if not provided", + "type": "string" + }, + "schedule": { + "description": "Schedule for the task, format following the cron string standard", + "type": "string" + }, + "request": { "$ref": "task_request.json" } + }, + "required": ["type", "request"] +} diff --git a/rmf_api_msgs/schemas/task_schedule_add_response.json b/rmf_api_msgs/schemas/task_schedule_add_response.json new file mode 100644 index 0000000..3d31fb1 --- /dev/null +++ b/rmf_api_msgs/schemas/task_schedule_add_response.json @@ -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"] + } + ] +} + diff --git a/rmf_api_msgs/schemas/task_schedule_remove_request.json b/rmf_api_msgs/schemas/task_schedule_remove_request.json new file mode 100644 index 0000000..3705584 --- /dev/null +++ b/rmf_api_msgs/schemas/task_schedule_remove_request.json @@ -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": "(Optional) Name for the scheduled task, if a task with this name already exists the schedule will be updated. Will be autogenerated if not provided", + "type": "string" + } + }, + "required": ["name"] +} + diff --git a/rmf_api_msgs/schemas/task_schedule_remove_response.json b/rmf_api_msgs/schemas/task_schedule_remove_response.json new file mode 100644 index 0000000..9191eab --- /dev/null +++ b/rmf_api_msgs/schemas/task_schedule_remove_response.json @@ -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"] + } + ] +} + + From 6acfd3e147b8ea775b2a77303c067560a9780e6c Mon Sep 17 00:00:00 2001 From: Luca Della Vedova Date: Wed, 22 Jun 2022 17:29:20 +0800 Subject: [PATCH 2/5] Add task schedule list request and response Signed-off-by: Luca Della Vedova --- rmf_api_msgs/schemas/task_schedule.json | 19 ++++++++++++ .../schemas/task_schedule_add_request.json | 12 ++------ .../schemas/task_schedule_list_request.json | 15 ++++++++++ .../schemas/task_schedule_list_response.json | 30 +++++++++++++++++++ 4 files changed, 66 insertions(+), 10 deletions(-) create mode 100644 rmf_api_msgs/schemas/task_schedule.json create mode 100644 rmf_api_msgs/schemas/task_schedule_list_request.json create mode 100644 rmf_api_msgs/schemas/task_schedule_list_response.json diff --git a/rmf_api_msgs/schemas/task_schedule.json b/rmf_api_msgs/schemas/task_schedule.json new file mode 100644 index 0000000..1654f9d --- /dev/null +++ b/rmf_api_msgs/schemas/task_schedule.json @@ -0,0 +1,19 @@ +{ + "$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": { + "name": { + "description": "Name for the scheduled task", + "type": "string" + }, + "schedule": { + "description": "Schedule for the task, format following the cron string standard", + "type": "string" + }, + "request": { "$ref": "task_request.json" } + }, + "required": ["request"] +} diff --git a/rmf_api_msgs/schemas/task_schedule_add_request.json b/rmf_api_msgs/schemas/task_schedule_add_request.json index 92006c3..91c08e3 100644 --- a/rmf_api_msgs/schemas/task_schedule_add_request.json +++ b/rmf_api_msgs/schemas/task_schedule_add_request.json @@ -10,15 +10,7 @@ "type": "string", "constant": "task_schedule_add_request" }, - "name": { - "description": "(Optional) Name for the scheduled task, if a task with this name already exists the schedule will be updated. Will be autogenerated if not provided", - "type": "string" - }, - "schedule": { - "description": "Schedule for the task, format following the cron string standard", - "type": "string" - }, - "request": { "$ref": "task_request.json" } + "schedule": { "$ref": "task_schedule.json" } }, - "required": ["type", "request"] + "required": ["type", "schedule"] } diff --git a/rmf_api_msgs/schemas/task_schedule_list_request.json b/rmf_api_msgs/schemas/task_schedule_list_request.json new file mode 100644 index 0000000..4a8c478 --- /dev/null +++ b/rmf_api_msgs/schemas/task_schedule_list_request.json @@ -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"] +} diff --git a/rmf_api_msgs/schemas/task_schedule_list_response.json b/rmf_api_msgs/schemas/task_schedule_list_response.json new file mode 100644 index 0000000..6f1548d --- /dev/null +++ b/rmf_api_msgs/schemas/task_schedule_list_response.json @@ -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"] +} From 7ff45bb47ebe77626e337e5e1793e4597987d2d8 Mon Sep 17 00:00:00 2001 From: Luca Della Vedova Date: Wed, 22 Jun 2022 17:35:19 +0800 Subject: [PATCH 3/5] Add start and finish time for schedule Signed-off-by: Luca Della Vedova --- rmf_api_msgs/schemas/task_schedule.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rmf_api_msgs/schemas/task_schedule.json b/rmf_api_msgs/schemas/task_schedule.json index 1654f9d..51042c3 100644 --- a/rmf_api_msgs/schemas/task_schedule.json +++ b/rmf_api_msgs/schemas/task_schedule.json @@ -13,6 +13,14 @@ "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": ["request"] From 0fa0d79ce48ecfd21a31472b0004497511ac6594 Mon Sep 17 00:00:00 2001 From: Luca Della Vedova Date: Mon, 27 Jun 2022 14:25:24 +0800 Subject: [PATCH 4/5] Update description and required fields Signed-off-by: Luca Della Vedova --- rmf_api_msgs/schemas/task_schedule.json | 2 +- rmf_api_msgs/schemas/task_schedule_remove_request.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rmf_api_msgs/schemas/task_schedule.json b/rmf_api_msgs/schemas/task_schedule.json index 51042c3..2a3f6ff 100644 --- a/rmf_api_msgs/schemas/task_schedule.json +++ b/rmf_api_msgs/schemas/task_schedule.json @@ -23,5 +23,5 @@ }, "request": { "$ref": "task_request.json" } }, - "required": ["request"] + "required": ["name", "schedule", "unix_millis_start_at", "unix_millis_finish_at", "request"] } diff --git a/rmf_api_msgs/schemas/task_schedule_remove_request.json b/rmf_api_msgs/schemas/task_schedule_remove_request.json index 3705584..9e29887 100644 --- a/rmf_api_msgs/schemas/task_schedule_remove_request.json +++ b/rmf_api_msgs/schemas/task_schedule_remove_request.json @@ -11,7 +11,7 @@ "constant": "task_schedule_remove_request" }, "name": { - "description": "(Optional) Name for the scheduled task, if a task with this name already exists the schedule will be updated. Will be autogenerated if not provided", + "description": "Name for the scheduled task to be removed", "type": "string" } }, From 62b06083bdcf8b36ebe8c351d91a2e1a29fdd524 Mon Sep 17 00:00:00 2001 From: Luca Della Vedova Date: Fri, 1 Jul 2022 11:28:27 +0800 Subject: [PATCH 5/5] Copy paste error in task schedule description Signed-off-by: Luca Della Vedova --- rmf_api_msgs/schemas/task_schedule.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rmf_api_msgs/schemas/task_schedule.json b/rmf_api_msgs/schemas/task_schedule.json index 2a3f6ff..2aabc81 100644 --- a/rmf_api_msgs/schemas/task_schedule.json +++ b/rmf_api_msgs/schemas/task_schedule.json @@ -1,8 +1,8 @@ { "$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", + "$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": {