Skip to content

Commit

Permalink
Properly cancel running job (cloud client)
Browse files Browse the repository at this point in the history
  • Loading branch information
Acly committed Nov 30, 2024
1 parent 5b286e1 commit 8f437d3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ai_diffusion/cloud_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,11 @@ async def _process_job(self, job: JobInfo):
log.warning(f"Got unknown job status {response['status']}")

async def interrupt(self):
if self._current_job:
if job := self._current_job:
self._cancel_requested = True
# if self._current_job.remote_id:
# await self._post(f"cancel/{self._current_job.remote_id}", {})
if job.remote_id and job.worker_id:
response = await self._post(f"cancel/{job.worker_id}/{job.remote_id}", {})
log.info(f"Requested cancellation of {job}: {response}")

async def clear_queue(self):
self._queue = asyncio.Queue()
Expand Down

0 comments on commit 8f437d3

Please sign in to comment.