Nicholas Bumgarner commited on
Commit
faa1f0b
·
1 Parent(s): 3e5b14e

Force re-download binary; fix lock contention in get_boot_status

Browse files
Files changed (1) hide show
  1. app.py +27 -23
app.py CHANGED
@@ -118,30 +118,34 @@ def boot_phoenix():
118
 
119
  # Phase 2: Download pre-built binary from HF Hub (avoids compilation on Space)
120
  _update_boot("build", "Downloading phoenix binary from Hub...")
121
- if not os.path.exists(PHOENIX_BIN):
122
- try:
123
- hf_hub_download(
124
- repo_id=MODEL_REPO,
125
- filename="phoenix",
126
- local_dir=SPACE_DIR,
127
- local_dir_use_symlinks=False,
128
- )
129
- os.chmod(PHOENIX_BIN, 0o755)
130
- except Exception as e:
131
- # Fallback: compile from source
132
- _update_boot("build", f"Binary download failed, compiling... ({e})")
133
- src_path = os.path.join(SPACE_DIR, "phoenix_brain.c")
134
- if os.path.exists(src_path):
135
- cc = os.environ.get("CC", "cc")
136
- cmd = [cc, "-O3", "-std=c11", "-march=native", "-fopenmp",
137
- src_path, "-o", PHOENIX_BIN, "-lm"]
138
- result = subprocess.run(cmd, capture_output=True, text=True, timeout=120)
139
- if result.returncode != 0:
140
- _update_boot("build", f"Build FAILED: {result.stderr[:500]}")
141
- return
142
- else:
143
- _update_boot("build", "No binary or source found!")
 
144
  return
 
 
 
145
  _update_boot("build", "Binary ready")
146
 
147
  # Phase 3: Start phoenix
 
118
 
119
  # Phase 2: Download pre-built binary from HF Hub (avoids compilation on Space)
120
  _update_boot("build", "Downloading phoenix binary from Hub...")
121
+ # Always re-download to ensure we get the latest binary
122
+ if os.path.exists(PHOENIX_BIN):
123
+ os.unlink(PHOENIX_BIN)
124
+ try:
125
+ hf_hub_download(
126
+ repo_id=MODEL_REPO,
127
+ filename="phoenix",
128
+ local_dir=SPACE_DIR,
129
+ local_dir_use_symlinks=False,
130
+ force_download=True,
131
+ force_filename="phoenix",
132
+ )
133
+ os.chmod(PHOENIX_BIN, 0o755)
134
+ except Exception as e:
135
+ # Fallback: compile from source
136
+ _update_boot("build", f"Binary download failed, compiling... ({e})")
137
+ src_path = os.path.join(SPACE_DIR, "phoenix_brain.c")
138
+ if os.path.exists(src_path):
139
+ cc = os.environ.get("CC", "cc")
140
+ cmd = [cc, "-O3", "-std=c11", "-march=native", "-fopenmp",
141
+ src_path, "-o", PHOENIX_BIN, "-lm"]
142
+ result = subprocess.run(cmd, capture_output=True, text=True, timeout=120)
143
+ if result.returncode != 0:
144
+ _update_boot("build", f"Build FAILED: {result.stderr[:500]}")
145
  return
146
+ else:
147
+ _update_boot("build", "No binary or source found!")
148
+ return
149
  _update_boot("build", "Binary ready")
150
 
151
  # Phase 3: Start phoenix