Perplexed7675 commited on
Commit
9efde37
·
verified ·
1 Parent(s): 58ef86c

Sync from kink_cli (Docker Space)

Browse files
Files changed (1) hide show
  1. scripts/publish_hf_space.py +7 -8
scripts/publish_hf_space.py CHANGED
@@ -121,13 +121,12 @@ def _resolve_app_url(api, repo_id: str, token: str) -> str:
121
 
122
 
123
  def _wait_running(api, repo_id: str, token: str, timeout_s: float = 900.0) -> None:
124
- ok = {
125
- "RUNNING",
126
- "RUNNING_BUILDING",
127
- "RUNNING_APP_STARTING",
128
- "APP_STARTING",
129
- }
130
- bad = {"BUILD_ERROR", "CONFIG_ERROR", "RUNTIME_ERROR"}
131
  deadline = time.time() + timeout_s
132
  last_stage = ""
133
  while time.time() < deadline:
@@ -137,7 +136,7 @@ def _wait_running(api, repo_id: str, token: str, timeout_s: float = 900.0) -> No
137
  if s != last_stage:
138
  print(f"Space stage: {s}", file=sys.stderr)
139
  last_stage = s
140
- if s in ok:
141
  return
142
  if s in bad:
143
  raise RuntimeError(f"Space build/runtime failed (stage={s}). Check logs on the Hub.")
 
121
 
122
 
123
  def _wait_running(api, repo_id: str, token: str, timeout_s: float = 900.0) -> None:
124
+ """Wait until the Space reports ``RUNNING`` (not ``RUNNING_BUILDING``).
125
+
126
+ ``RUNNING_BUILDING`` means the *previous* revision is still serving while a new build runs; probing
127
+ the app URL then hits stale code and ``publish_hf_space.py --verify`` can falsely fail.
128
+ """
129
+ bad = {"BUILD_ERROR", "CONFIG_ERROR", "RUNTIME_ERROR", "NO_APP_FILE"}
 
130
  deadline = time.time() + timeout_s
131
  last_stage = ""
132
  while time.time() < deadline:
 
136
  if s != last_stage:
137
  print(f"Space stage: {s}", file=sys.stderr)
138
  last_stage = s
139
+ if s == "RUNNING":
140
  return
141
  if s in bad:
142
  raise RuntimeError(f"Space build/runtime failed (stage={s}). Check logs on the Hub.")