Conversation
This was referenced Aug 20, 2026
Every main.py in every node repository repeats the same twenty lines: read UVICORN_RELOAD, build the settings, construct the node, call uvicorn.run. Eight copies across three repositories, and they had drifted - dfine parses settings with configargparse so each one is both a flag and an environment variable, while the others hand-roll os.getenv plus asserts and hardcode the host and port. node_parser and run_node put that in one place. A setting is named after its flag: --conf-threshold reads CONF_THRESHOLD. That is what yolov5_node and classification_node already use, so adopting this renames nothing in the repositories that are actually deployed. --host and --port are the exception, reading NODE_HOST and NODE_PORT. The bare HOST already means the loop's address - every deployment sets it - and a node adopting that would hand it to uvicorn and fail to bind. dfine_node required a DFINE_TRAINER_ / DFINE_DETECTOR_ prefix, so it passes legacy_env_prefix and its prefixed names keep working with a warning naming the replacement. The logging.basicConfig call the trainers carry is not reproduced here - the library configures the root logger on import, so it has been a no-op. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
klangenk
force-pushed
the
share-node-entrypoint
branch
from
August 21, 2026 06:42
e1bd034 to
fa8505c
Compare
Contributor
Author
|
Superseded by #94, which combines all three phases into one PR per repository. The commits are unchanged and still readable in order. |
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.
Motivation
Every node's
main.pyrepeats the same twenty lines — readUVICORN_RELOAD, build the settings, construct the node, calluvicorn.run. There are eight copies across the three node repositories, and they have drifted:dfine_nodeparses settings with configargparse so each one is both a flag and an environment variable, whileyolov5_nodeandclassification_nodehand-rollos.getenvwithasserts and hardcode the host and port.This puts it in one place, so a new node's entry point is the two lines that are actually its own.
Stacked on #89; review that one first.
Implementation
helpers/entrypoint.pywithnode_parser(description=, legacy_env_prefix=)andrun_node(app, args)--conf-thresholdreadsCONF_THRESHOLD. One declaration yields a flag, an environment variable, and a--helpentry.legacy_env_prefixaccepts a prefix an earlier version of a node required, with a warning naming the replacement, so adopting this breaks no deploymentconfigargparseto the runtime dependenciestests/unitWhy unprefixed names
dfine_noderequired aDFINE_TRAINER_/DFINE_DETECTOR_prefix; the other two read bare names. Bare wins here becauseyolov5_nodeis the widely deployed one anddfine_nodeis still in beta — so the repositories running in the field keep every variable they already set, and the one repository that has to move is the one where moving is cheap.dfine_nodepasseslegacy_env_prefixso its beta deployments keep working meanwhile.--hostand--portare the exceptionThey read
NODE_HOSTandNODE_PORT, not the names their flags imply. The bareHOSTalready means the loop's address — every deployment sets it,face_detection's compose file setsHOST=preview.learning-loop.ai— and a node adopting it would hand that to uvicorn and fail to bind. There is a test asserting exactly this.Note
logging.basicConfig(...)in the trainers is deliberately not reproduced.helpers/log_conf.pyconfigures the root logger at import, sobasicConfighas been returning without doing anything — verified, not assumed.⬛ claude-opus-5[1m] · 600k tokens · $14.50