Repository navigation
Wake the local On Premise worker after the CLI creates its job - #131
Conversation
|
👋 Hello @glenn-jocher, thank you for submitting a
For more guidance, please refer to our Contributing Guide. Don't hesitate to leave a comment if you have any questions. Thank you for contributing to Ultralytics! 🚀 |
UltralyticsAssistant
left a comment
There was a problem hiding this comment.
🔍 PR Review
Made with ❤️ by Ultralytics Actions
Reviewed the CLI response hook, regenerated CLI, and wire test. Successful ingest and training-start responses trigger a best-effort local wake without changing API return handling. No actionable issue found; LGTM. The wake can add up to 0.5 seconds to those CLI requests when the local worker does not respond.
|
Excited to see this PR merged—thank you, @glenn-jocher! The wake signal helps the local On Premise worker claim successful ingest and training-start jobs without waiting for its next poll.
|
Summary
Platform's On Premise workers pick up jobs on a 2 s poll. The worker's local server now has a
GET http://127.0.0.1:8765/wakeendpoint, so whoever creates a job on the same machine can make the worker claim it immediately. The Platform page calls it after creating an On Premise ingest or training job. This PR does the same for theulCLI.cli.py: a response event hook on the CLI'sPlatformclient. After a successfulPOST …/ingestorPOST /api/training/start, it sends a best-effort wake withOriginset to the Platform URL, a 0.5 s timeout,trust_env=False(so a proxy can't capture loopback), and everyhttpx.HTTPErrorsuppressed. Return values never change.timeout=60.0, the generated default, because passinghttp_clientwould otherwise fall back to httpx's 5 s default.sdk/python/src/ultralytics_platform/cli.pyis regenerated from the generator'smain; the drift check passes.The Python SDK classes (
Platform/AsyncPlatform) are fully generated and have no hand-written hook point. Covering them needs the generator's newpython.hooksProvider(ultralytics/openapi#60); that follow-up is separate.No version bump.
Validation
pytest tests -v: 6 passed. The CLI wire test runs a failed start, a successful start and an ingest against a listener on 8765, and asserts exactly 2 wakes with the PlatformOrigin. With the hook removed it fails.ruff format --checkandruff check: clean./wakehandler:Origin: the wake is set in 2.8 msOrigin: 403, swallowedHTTP_PROXYset: the call still reaches loopback🛠️ PR Summary
Made with ❤️ by Ultralytics Actions
🌟 Summary
The CLI now signals the local On Premise worker after successful ingest and training-start requests so it can claim jobs without waiting for its polling interval.
📊 Key Changes
Platformclient for successfulPOSTrequests ending in/ingestor/training/start.GET http://127.0.0.1:8765/wakewith the Platform URL asOrigin, bypasses environment proxies, and suppresses HTTP errors after a 0.5-second timeout.🎯 Purpose & Impact