Improve client script formatting (black linter formatting) and added logger once runner start#705
Merged
luv-bansal merged 14 commits intomasterfrom Jul 17, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the client code generator to use f-strings, improves the layout of generated snippets, and adds a startup log in the runner server.
- Migrates
%-style formatting to inline f-strings and standardizes string quoting. - Reorganizes generated method and model sections into clearer multi-line blocks.
- Logs a message when the runner starts in
server.py.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| clarifai/runners/utils/code_script.py | Switched templates to f-strings, streamlined parameter blocks. |
| clarifai/runners/server.py | Inserted a logger.info call after runner startup. |
Comments suppressed due to low confidence (2)
clarifai/runners/utils/code_script.py:47
- [nitpick] The triple-quoted f-string with nested braces and manual escaping can be fragile and hard to read. Consider using textwrap.dedent to clean up indentation and externalize nested dicts or format them programmatically to avoid double-brace escaping.
_CLIENT_TEMPLATE = f"""
clarifai/runners/server.py:136
- Ensure that
loggeris imported and initialized (e.g., viaimport loggingandlogger = logging.getLogger(__name__)) before callinglogger.info, otherwise this will raise a NameError.
logger.info("Runner started successfully and is waiting for work from the API...")
Minimum allowed line rate is |
mogith-pn
approved these changes
Jul 17, 2025
Contributor
mogith-pn
left a comment
There was a problem hiding this comment.
Looks good. Nothing from my side.
srikanthbachala20
pushed a commit
that referenced
this pull request
Jul 23, 2025
…logger once runner start (#705) * VERSION-11.5.5 * Black linter to fix stylistic issues and ensure it follows to common Python standards * better representation * fix formatting * fix formatting * fix formatting
srikanthbachala20
added a commit
that referenced
this pull request
Jul 23, 2025
* Initial plan * Implement CLI config context fallback in BaseClient Co-authored-by: srikanthbachala20 <170492893+srikanthbachala20@users.noreply.github.com> * Remove tests/test_base_client_cli_config.py file as requested Co-authored-by: srikanthbachala20 <170492893+srikanthbachala20@users.noreply.github.com> * Remove tests/test_misc_cli_config.py as requested Co-authored-by: srikanthbachala20 <170492893+srikanthbachala20@users.noreply.github.com> * [PR-725]: Using Config Context in Baseclient class * Improve error message formatting and clarity in authentication Co-authored-by: luv-bansal <70321430+luv-bansal@users.noreply.github.com> * Add github folder download support and toolkit option in model init (#699) * added github folder download support * modified folder structure validation * supported toolkit options for ollama * fixed param name and toolkit bugs * removed print in misc.py * updated with log and raise * Update clarifai/utils/misc.py Co-authored-by: Srikanth Bachala <srikanth.bachala@clarifai.com> --------- Co-authored-by: Srikanth Bachala <srikanth.bachala@clarifai.com> * Improve client script formatting (black linter formatting) and added logger once runner start (#705) * VERSION-11.5.5 * Black linter to fix stylistic issues and ensure it follows to common Python standards * better representation * fix formatting * fix formatting * fix formatting * [PR-727]: Improve Local-Runner CLI Logging (#706) * [PR-727]: Improve Local-Runner CLI Logging * [PR-727]: Improve Local-Runner CLI Logging * [PR-727]: Improve Local-Runner CLI Logging * [PR-727]: Improve Local-Runner CLI Logging * PR-323 Unit tests for toolkits. (#639) * added initial vllm unit tests * modified permissions for maintainer_tests.yml * modified yaml file * removed codecoverage for maintainer tests * modified env vars for tests * added labels to tests * removed inputs in workflow disptach * added pytest.ini * removed unused functions * added --enforce-eager option * removed redundant URL logging * Added Playground URL to Local-Runner Logs (#708) * [PR-733] Improve URL Download error handling (#710) * Improve error handling * Improve error handling * Improve error handling * Added local-runner requirements validation step (#712) * added local-runner requirements validation step * added post check for ollama toolkit * fixed tests * [EAGLE-6460]: Add func to return both stub and channel. (#713) * Add func to return both stub and channel. * tidy * [PR-739] [PR-740] Unify Context Management Under a Single config Command (#709) * Unify Context Management Under a Single context Command * login func * improvemensts and fix tests * better alias * active to current * Unify config * Update readme * fix test * update readme * update readme * update readme * add set-context alias * Initial plan * [PR-725]: Using Config Context in Baseclient class --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: srikanthbachala20 <170492893+srikanthbachala20@users.noreply.github.com> Co-authored-by: Srikanth Bachala <srikanth.bachala@clarifai.com> Co-authored-by: luv-bansal <70321430+luv-bansal@users.noreply.github.com> Co-authored-by: mogith-pn <143642606+mogith-pn@users.noreply.github.com> Co-authored-by: Patrick Lundquist <1460278+patricklundquist@users.noreply.github.com>
Merged
srikanthbachala20
pushed a commit
that referenced
this pull request
Jul 29, 2025
…logger once runner start (#705) * VERSION-11.5.5 * Black linter to fix stylistic issues and ensure it follows to common Python standards * better representation * fix formatting * fix formatting * fix formatting
srikanthbachala20
added a commit
that referenced
this pull request
Jul 29, 2025
* Initial plan * Implement CLI config context fallback in BaseClient Co-authored-by: srikanthbachala20 <170492893+srikanthbachala20@users.noreply.github.com> * Remove tests/test_base_client_cli_config.py file as requested Co-authored-by: srikanthbachala20 <170492893+srikanthbachala20@users.noreply.github.com> * Remove tests/test_misc_cli_config.py as requested Co-authored-by: srikanthbachala20 <170492893+srikanthbachala20@users.noreply.github.com> * [PR-725]: Using Config Context in Baseclient class * Improve error message formatting and clarity in authentication Co-authored-by: luv-bansal <70321430+luv-bansal@users.noreply.github.com> * Add github folder download support and toolkit option in model init (#699) * added github folder download support * modified folder structure validation * supported toolkit options for ollama * fixed param name and toolkit bugs * removed print in misc.py * updated with log and raise * Update clarifai/utils/misc.py Co-authored-by: Srikanth Bachala <srikanth.bachala@clarifai.com> --------- Co-authored-by: Srikanth Bachala <srikanth.bachala@clarifai.com> * Improve client script formatting (black linter formatting) and added logger once runner start (#705) * VERSION-11.5.5 * Black linter to fix stylistic issues and ensure it follows to common Python standards * better representation * fix formatting * fix formatting * fix formatting * [PR-727]: Improve Local-Runner CLI Logging (#706) * [PR-727]: Improve Local-Runner CLI Logging * [PR-727]: Improve Local-Runner CLI Logging * [PR-727]: Improve Local-Runner CLI Logging * [PR-727]: Improve Local-Runner CLI Logging * PR-323 Unit tests for toolkits. (#639) * added initial vllm unit tests * modified permissions for maintainer_tests.yml * modified yaml file * removed codecoverage for maintainer tests * modified env vars for tests * added labels to tests * removed inputs in workflow disptach * added pytest.ini * removed unused functions * added --enforce-eager option * removed redundant URL logging * Added Playground URL to Local-Runner Logs (#708) * [PR-733] Improve URL Download error handling (#710) * Improve error handling * Improve error handling * Improve error handling * Added local-runner requirements validation step (#712) * added local-runner requirements validation step * added post check for ollama toolkit * fixed tests * [EAGLE-6460]: Add func to return both stub and channel. (#713) * Add func to return both stub and channel. * tidy * [PR-739] [PR-740] Unify Context Management Under a Single config Command (#709) * Unify Context Management Under a Single context Command * login func * improvemensts and fix tests * better alias * active to current * Unify config * Update readme * fix test * update readme * update readme * update readme * add set-context alias * Initial plan * [PR-725]: Using Config Context in Baseclient class --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: srikanthbachala20 <170492893+srikanthbachala20@users.noreply.github.com> Co-authored-by: Srikanth Bachala <srikanth.bachala@clarifai.com> Co-authored-by: luv-bansal <70321430+luv-bansal@users.noreply.github.com> Co-authored-by: mogith-pn <143642606+mogith-pn@users.noreply.github.com> Co-authored-by: Patrick Lundquist <1460278+patricklundquist@users.noreply.github.com>
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.
Pull Request Overview
This PR refactors the client code generator to use f-strings, improves the layout of generated snippets, and adds a startup log in the runner server.
%-style formatting to inline f-strings and standardizes string quoting.server.py.