job_queue: rename "resume" api to "start"

Given the changes to the job queue, "start" is a more
appropriate API call than "resume".

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2021-11-27 06:04:47 -05:00
parent 4837ea56cb
commit 269897bef7
2 changed files with 15 additions and 14 deletions

View File

@ -2340,21 +2340,22 @@ The current state of the job queue:
}
```
#### Resume the job queue
#### Start the job queue
Sets the job queue state to "resume". This will set the job
queue to state to "idle". If the queue is not empty the next job
in the queue will be loaded.
Starts the job queue. If Klipper is ready to start a print the next
job in the queue will be loaded. Otherwise the queue will be put
into the "ready" state, enabling automatic transition after the next
completed print.
HTTP request:
```http
POST /server/job_queue/resume
POST /server/job_queue/start
```
JSON-RPC request:
```json
{
"jsonrpc": "2.0",
"method": "server.job_queue.resume",
"method": "server.job_queue.start",
"id": 4654
}
```

View File

@ -53,8 +53,8 @@ class JobQueue:
"job_state:cancelled", self._on_job_abort)
self.server.register_remote_method("pause_job_queue", self.pause_queue)
self.server.register_remote_method("resume_job_queue",
self.resume_queue)
self.server.register_remote_method("start_job_queue",
self.start_queue)
self.server.register_endpoint(
"/server/job_queue/job", ['POST', 'DELETE'],
@ -62,7 +62,7 @@ class JobQueue:
self.server.register_endpoint(
"/server/job_queue/pause", ['POST'], self._handle_pause_queue)
self.server.register_endpoint(
"/server/job_queue/resume", ['POST'], self._handle_resume_queue)
"/server/job_queue/start", ['POST'], self._handle_start_queue)
self.server.register_endpoint(
"/server/job_queue/status", ['GET'], self._handle_queue_status)
@ -172,7 +172,7 @@ class JobQueue:
await self.lock.acquire()
self.lock.release()
async def resume_queue(self) -> None:
async def start_queue(self) -> None:
async with self.lock:
if self.queue_state != "loading":
if self.queued_jobs and await self._check_can_print():
@ -235,10 +235,10 @@ class JobQueue:
'queue_state': self.queue_state
}
async def _handle_resume_queue(self,
web_request: WebRequest
) -> Dict[str, Any]:
await self.resume_queue()
async def _handle_start_queue(self,
web_request: WebRequest
) -> Dict[str, Any]:
await self.start_queue()
return {
'queued_jobs': self._job_map_to_list(),
'queue_state': self.queue_state