Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
752ab1a
Add python profiling utilities
Eden-D-Zhang Oct 14, 2025
29436b6
Add profiling to query functions
Eden-D-Zhang Oct 14, 2025
4d19c81
Remove `CLP_ENABLE_PROFILING` environment variable check
Eden-D-Zhang Oct 14, 2025
b5bdcf1
Lint
Eden-D-Zhang Oct 14, 2025
02b29fb
Merge branch 'main' of https://github.com/y-scope/clp into pyinstrume…
Eden-D-Zhang Oct 14, 2025
6f65035
Clean up docstrings
Eden-D-Zhang Oct 14, 2025
c2be1f6
Remove __all__
Eden-D-Zhang Oct 15, 2025
a677177
Merge branch 'main' of https://github.com/Eden-D-Zhang/clp into pyins…
Eden-D-Zhang Oct 15, 2025
cc85f93
Remove unnecessary function
Eden-D-Zhang Oct 15, 2025
9810d31
Address review
Eden-D-Zhang Oct 16, 2025
b013429
Merge branch 'main' into pyinstrument_profile
Eden-D-Zhang Oct 16, 2025
a33a9c1
Address review
Eden-D-Zhang Oct 16, 2025
99d134b
Lint
Eden-D-Zhang Oct 16, 2025
61e8332
Merge branch 'main' of https://github.com/y-scope/clp into pyinstrume…
Eden-D-Zhang Oct 21, 2025
ab6ee4f
Upate lock file
Eden-D-Zhang Oct 21, 2025
cbb32de
Update dependencies and lock file
Eden-D-Zhang Oct 21, 2025
8447f12
Merge branch 'main' of https://github.com/y-scope/clp into pyinstrume…
Eden-D-Zhang Oct 21, 2025
159e645
Address review
Eden-D-Zhang Oct 21, 2025
4080df6
Delete file
Eden-D-Zhang Oct 21, 2025
7df8e09
Merge branch 'main' into pyinstrument_profile
Eden-D-Zhang Oct 21, 2025
4089eb0
Change constant name
Eden-D-Zhang Oct 21, 2025
11641e2
Merge branch 'pyinstrument_profile' of https://github.com/Eden-D-Zhan…
Eden-D-Zhang Oct 21, 2025
9437246
Change typing imports according to coderabbit
Eden-D-Zhang Oct 21, 2025
ada4073
Lint
Eden-D-Zhang Oct 21, 2025
e94d2cc
Add clp_logging logger, type annotations
Eden-D-Zhang Oct 23, 2025
8beeda2
Merge branch 'main' of https://github.com/y-scope/clp into pyinstrume…
Eden-D-Zhang Oct 23, 2025
e6dfbea
Lint
Eden-D-Zhang Oct 23, 2025
5501b7f
Merge branch 'pyinstrument_profile' into profile-setting
sitaowang1998 Oct 23, 2025
555592f
Add env for enable profiling
sitaowang1998 Oct 23, 2025
24d8213
Add default for CLP_ENABLE_PROFILING
sitaowang1998 Oct 23, 2025
3ec8d9f
Merge branch 'main' into profile-setting
sitaowang1998 Oct 24, 2025
e9cba89
Rename variable
sitaowang1998 Oct 24, 2025
344b018
Reorder env
sitaowang1998 Oct 24, 2025
1d9a7be
Merge branch 'main' into profile-setting
sitaowang1998 Oct 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,13 @@ def _set_up_env_for_query_worker(self, num_workers: int) -> EnvVarsDict:
"CLP_QUERY_WORKER_LOGGING_LEVEL": self._clp_config.query_worker.logging_level,
}

# Profiling config
env_vars |= {
"CLP_QUERY_WORKER_ENABLE_PROFILING": str(
self._clp_config.query_worker.enable_profiling
).lower(),
}

# Resources
env_vars |= {
"CLP_QUERY_WORKER_CONCURRENCY": str(num_workers),
Expand Down
1 change: 1 addition & 0 deletions components/clp-py-utils/clp_py_utils/clp_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ class CompressionWorker(BaseModel):

class QueryWorker(BaseModel):
logging_level: LoggingLevel = "INFO"
enable_profiling: bool = False

Comment on lines 275 to 278
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

🧩 Analysis chain

Add field description for clarity and ensure env plumbing is present.

Document the new config knob.

 class QueryWorker(BaseModel):
     logging_level: LoggingLevel = "INFO"
-    enable_profiling: bool = False
+    enable_profiling: bool = Field(
+        False,
+        description="Enable pyinstrument runtime profiling for query worker tasks."
+    )

Run to confirm the plumbing from config -> env -> container:


🏁 Script executed:

#!/bin/bash
# Verify config->env mapping for profiling
rg -nC2 -e 'CLP_QUERY_WORKER_ENABLE_PROFILING|CLP_ENABLE_PROFILING|enable_profiling' \
  --glob '!**/dist/**' --glob '!**/build/**'

Length of output: 2231


Add field description for documentation clarity.

The config → env plumbing is already correctly implemented and verified. Consider adding a Field description to document the profiling knob:

[optional_refactor_recommended]

 class QueryWorker(BaseModel):
     logging_level: LoggingLevel = "INFO"
-    enable_profiling: bool = False
+    enable_profiling: bool = Field(
+        False,
+        description="Enable pyinstrument runtime profiling for query worker tasks."
+    )
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
class QueryWorker(BaseModel):
logging_level: LoggingLevel = "INFO"
enable_profiling: bool = False
class QueryWorker(BaseModel):
logging_level: LoggingLevel = "INFO"
enable_profiling: bool = Field(
False,
description="Enable pyinstrument runtime profiling for query worker tasks."
)
🤖 Prompt for AI Agents
In components/clp-py-utils/clp_py_utils/clp_config.py around lines 272 to 275,
add a Field description to the enable_profiling attribute to document what the
profiling knob does; replace the bare bool annotation with a pydantic Field for
enable_profiling that includes a concise description (e.g., when True, enables
runtime profiling for query workers and controls output location/verbosity as
applicable) so the generated docs and env config are clear.


class Redis(BaseModel):
Expand Down
6 changes: 4 additions & 2 deletions components/clp-py-utils/clp_py_utils/profiling_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,12 @@ def extract_value(param_spec: str) -> str:
def _is_profiling_enabled() -> bool:
"""
Checks if profiling is enabled.
TODO: Add `CLPConfig` mechanism to enable/disable profiling for each component.

:return: Whether the profiler is enabled.
:return: If `CLP_ENABLE_PROFILING` environment variable is set to `true`.
"""
profile_enabled = os.getenv("CLP_ENABLE_PROFILING")
if profile_enabled is not None and profile_enabled.lower() == "true":
return True
return False


Expand Down
1 change: 1 addition & 0 deletions tools/deployment/package/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ services:
CLP_LOGGING_LEVEL: "${CLP_QUERY_WORKER_LOGGING_LEVEL:-INFO}"
CLP_LOGS_DIR: "/var/log/query_worker"
CLP_WORKER_LOG_PATH: "/var/log/query_worker/worker.log"
CLP_ENABLE_PROFILING: "${CLP_QUERY_WORKER_ENABLE_PROFILING}"
PYTHONPATH: "/opt/clp/lib/python3/site-packages"
RESULT_BACKEND: "redis://default:${CLP_REDIS_PASS:?Please set a value.}@redis:6379\
/${CLP_REDIS_BACKEND_DB_QUERY:-0}"
Expand Down
Loading