Skip to content
Open
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
1 change: 1 addition & 0 deletions runpod/serverless/modules/rp_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ async def handle_job(session: ClientSession, config: Dict[str, Any], job) -> dic

# Send the job result back to JOB_DONE_URL
await send_result(session, job_result, job, is_stream=is_stream)
return job_result


async def run_job(handler: Callable, job: Dict[str, Any]) -> Dict[str, Any]:
Expand Down
9 changes: 7 additions & 2 deletions runpod/serverless/modules/rp_scale.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,9 +562,14 @@ async def handle_job(self, session: ClientSession, job: dict[str, Any]):
)
return

await self.jobs_handler(session, self.config, job)
job_result = await self.jobs_handler(session, self.config, job)

if self.config.get("refresh_worker", False):
# Stop intake before the finally frees this slot: the platform
# restarts the worker on stopPod, killing any job taken meanwhile.
if self.config.get("refresh_worker", False) or (
isinstance(job_result, dict) and job_result.get("stopPod")
):
log.info("Refresh requested, taking no more jobs.", job["id"])
self.kill_worker()

except asyncio.CancelledError:
Expand Down
Loading
Loading