Repository navigation
fix(apps): give each dev session its own template names - #683
Draft
justinwlin wants to merge 1 commit into
Draft
justinwlin wants to merge 1 commit into
justinwlin wants to merge 1 commit into
Conversation
rp flash dev failed with "endpoint template names must be unique" when the same app started again soon after a session. Dev endpoint names are fixed per app and resource, and their bound templates took the same name. A deleted endpoint keeps its template for up to about 90 minutes, so the next session's create collided with it. Each session now names its bound templates <endpoint name>-<token>. Endpoint names stay fixed so adoption still works, refreshes reuse the session's name, and an adopted endpoint's template is renamed.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
rp flash devfails when you start the same app again soon after a session:Cause. Dev endpoint names are fixed per app and resource (so a session can adopt its own leftovers), and each endpoint's bound template took the same name. When a session ends, it deletes its endpoints, but the platform keeps a deleted endpoint's template until its last worker is billed, up to about 90 minutes. A new session's create collides with that held template.
Fix. Each
DevSessionnames its bound templates<endpoint name>-<token>, with one random token per session.saveEndpointupdate with a new template name renames the same bound template (sametemplateId), checked live.Setting
template.nameroutes dev saves through GraphQL. Traced live sessions already used GraphQL, and the REST path would name the template<endpoint name>-template, which is just as fixed.How I tested
tests/test_apps/test_dev.py: the payload carries the name, two sessions get different names for one endpoint, refresh keeps the name, adoption renames. All 4 fail onmainand pass with the fix.make test-coverage: 2358 passed, coverage 93.80%.black --checkpasses onrunpod/apps/dev.py.tests/test_apps/test_dev.pyalready has black diffs onmain; the new tests add none.Live proof (2026-11-04)
A one-function CPU app (
App("devtpl-repro"),@app.queue(cpu="cpu3c-1-2")), run withrp flash dev tiny.py --onceand a wrapper that logs eachsaveEndpointcall.main, run 1 then run 2 right after:This branch, two runs back to back (the first one while
main's template above was still held):deleteTemplateon a held template returns: "Template is still held by deleted endpoint …, which is pending cleanup. It can be deleted once that endpoint's last worker has been billed, within about 90 minutes of the endpoint delete." Held templates disappear on their own after that, so per-session names don't accumulate.Template rename on update (CPU endpoint, 0 workers, deleted after):
…-a…-a…-b…-b…-a…-a