MCPcopy Index your code
hub / github.com/reflex-dev/reflex / get_backend_compile_trigger

Function get_backend_compile_trigger

reflex/utils/exec.py:51–72  ·  view source on GitHub ↗

Determine the compile trigger and claim the dev backend reload marker. Atomically creates the marker so a failed first compile is still treated as the first worker boot: the next worker (after the user fixes the error) will see the marker and report ``hot_reload``. If the marker can

()

Source from the content-addressed store, hash-verified

49
50
51def get_backend_compile_trigger() -> CompileTrigger:
52 """Determine the compile trigger and claim the dev backend reload marker.
53
54 Atomically creates the marker so a failed first compile is still treated
55 as the first worker boot: the next worker (after the user fixes the
56 error) will see the marker and report ``hot_reload``. If the marker
57 cannot be created (e.g. permission error, missing parent dir), falls
58 back to ``backend_startup``.
59
60 Returns:
61 ``"backend_startup"`` for non-dev startups and the first dev
62 reload-capable worker boot, ``"hot_reload"`` for subsequent boots.
63 """
64 if not environment.REFLEX_DEV_BACKEND_RELOAD_ACTIVE.get():
65 return "backend_startup"
66 try:
67 os.close(os.open(get_dev_backend_reload_marker(), os.O_CREAT | os.O_EXCL))
68 except FileExistsError:
69 return "hot_reload"
70 except OSError:
71 pass
72 return "backend_startup"
73
74
75def get_package_json_and_hash(package_json_path: Path) -> tuple[PackageJson, str]:

Callers 1

__call__Method · 0.90

Calls 4

openMethod · 0.80
getMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected