mirror of
https://github.com/shinyobjectz/raea.git
synced 2026-12-01 06:53:19 -10:00
The farm renders with raea's newest release, and says which one it holds
farm.py took RAEA_VERSION or 0.1.6, and no deploy set the variable: on 11-29 the farm's health said 0.1.6 while the boxes that send it their compositions ran 0.1.12. A container never had the variable either, so health said the default whatever the image was built with. A deploy now takes the newest full release (GitHub's releases/latest, as box.sh does) unless RAEA_VERSION pins one, with 0.1.12 when GitHub can't be asked, and the image carries the version it was built with for its containers. Not deployed: the next modal deploy of raea-farm brings it.
This commit is contained in:
1 parent
f4db12c1d0
commit
4b2225163e
1 file changed
+32
-1
@@ -38,7 +38,36 @@ import modal
|
||||
|
||||
HERE = os.path.dirname(os.path.abspath(__file__))
|
||||
CLOUD = os.path.dirname(os.path.dirname(HERE))
|
||||
RAEA = os.environ.get("RAEA_VERSION", "0.1.6")
|
||||
|
||||
|
||||
def raea_version(env=os.environ, local=None, latest=None):
|
||||
"""The raea the farm renders with: RAEA_VERSION when it's set (a deploy that pins one, and every container, whose
|
||||
image carries the version it was built with), else, at a deploy, raea's newest release, as the boxes take
|
||||
(deploy/sprites/box.sh). Until 11-29 this was "0.1.6" unless a deploy remembered the variable, and none did: the
|
||||
farm drew 0.1.12 boxes' compositions with a raea six releases old, and a container, which never had the variable,
|
||||
said 0.1.6 in /v1/health whatever its image held."""
|
||||
if env.get("RAEA_VERSION"):
|
||||
return env["RAEA_VERSION"]
|
||||
if modal.is_local() if local is None else local:
|
||||
try:
|
||||
v = (latest or _latest_release)()
|
||||
if re.fullmatch(r"\d+\.\d+\.\d+", v or ""):
|
||||
return v
|
||||
except Exception: # no network at a deploy: the fallback below, and the deploy's own log says which
|
||||
pass
|
||||
return RAEA_FALLBACK
|
||||
|
||||
|
||||
def _latest_release():
|
||||
import urllib.request
|
||||
|
||||
# releases/latest answers with a redirect to the newest full release's tag (never a pre-release)
|
||||
with urllib.request.urlopen("https://github.com/shinyobjectz/raea/releases/latest", timeout=20) as r:
|
||||
return r.geturl().rstrip("/").rsplit("/v", 1)[-1]
|
||||
|
||||
|
||||
RAEA_FALLBACK = "0.1.12"
|
||||
RAEA = raea_version()
|
||||
BLENDER = os.environ.get("RAEA_FARM_BLENDER", "5.3.0")
|
||||
# The GPUs each kind of job takes, the first Modal has free (bench/gpus.py, 11-17): raea's frames are bound by its CPU
|
||||
# (React on QuickJS), so a T4 or an A10 draws them for the least a frame; Cycles gets the most samples a dollar on an
|
||||
@@ -65,6 +94,8 @@ image = (
|
||||
f"set -e; v={BLENDER}; curl -fsSL https://download.blender.org/release/Blender${{v%.*}}/blender-$v-linux-x64.tar.xz "
|
||||
"| tar -xJ -C /opt && ln -s /opt/blender-$v-linux-x64/blender /usr/local/bin/blender && blender -b --version | head -1",
|
||||
)
|
||||
# what this image holds, for the containers: /v1/health says it, and the module agrees with the deploy that built it
|
||||
.env({"RAEA_VERSION": RAEA})
|
||||
.pip_install("fastapi[standard]==0.121.2")
|
||||
# /v1/faces: OpenCV's YuNet face detector (232 KB, CPU), for the boxes' frames check (server/frames.ts): a box has
|
||||
# no vision backend of its own (raea-perceive isn't in raea's Linux build), so a face cut by a 9:16 crop went unseen
|
||||
|
||||
Reference in new issue
Block a user