-
Notifications
You must be signed in to change notification settings - Fork 163
feat: Add flag config to store stat data into Redis or no #5051
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: octodog <[email protected]>
@@ -606,50 +626,40 @@ | |||
async def batch_load_live_stat( | |||
cls, ctx: GraphQueryContext, agent_ids: Sequence[str] | |||
) -> Sequence[Any]: | |||
async def _pipe_builder(r: Redis): | |||
pipe = r.pipeline() | |||
# TODO: make it work |
Check notice
Code scanning / devskim
A "TODO" or similar was left in source code, possibly indicating incomplete functionality Note
@property | ||
def _metric_query_endpoint(self) -> yarl.URL: | ||
metric_query_addr = self._config_provider.config.metric.address.to_legacy() | ||
return yarl.URL(f"http://{metric_query_addr}/api/v1") |
Check warning
Code scanning / devskim
An HTTP-based URL without TLS was detected. Warning
metric_name: str, | ||
label: DeviceMetricOptionalLabel, | ||
) -> UtilizationMetricType: | ||
# TODO: Define device metadata for each metric and use it rather than hardcoding |
Check notice
Code scanning / devskim
A "TODO" or similar was left in source code, possibly indicating incomplete functionality Note
async def _pipe_builder(r: Redis): | ||
pipe = r.pipeline() | ||
for agent_id in agent_ids: | ||
await pipe.get(agent_id) | ||
return pipe | ||
|
||
return ret | ||
ret = [] | ||
for stat in await redis_helper.execute(ctx.redis_stat, _pipe_builder): | ||
if stat is not None: | ||
ret.append(msgpack.unpackb(stat, ext_hook_mapping=msgpack.uuid_to_str)) | ||
else: | ||
ret.append(None) | ||
|
||
@classmethod | ||
async def batch_load_cpu_cur_pct( | ||
cls, ctx: GraphQueryContext, agent_ids: Sequence[str] | ||
) -> Sequence[Any]: | ||
ret = [] | ||
for stat in await cls.batch_load_live_stat(ctx, agent_ids): | ||
if stat is not None: | ||
try: | ||
ret.append(float(stat["node"]["cpu_util"]["pct"])) | ||
except (KeyError, TypeError, ValueError): | ||
ret.append(0.0) | ||
else: | ||
ret.append(0.0) | ||
return ret | ||
return ret |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part may need to be added to the valkey client implementation.
resolves #5027 (BA-1802)
Checklist: (if applicable)
ai.backend.test
docs
directory