MCPcopy Index your code
hub / github.com/feast-dev/feast / monitor_resources

Function monitor_resources

sdk/python/feast/metrics.py:518–530  ·  view source on GitHub ↗

Background thread target that updates CPU and memory usage gauges.

(interval: int = 5)

Source from the content-addressed store, hash-verified

516
517
518def monitor_resources(interval: int = 5):
519 """Background thread target that updates CPU and memory usage gauges."""
520 logger.debug("Starting resource monitoring with interval %d seconds", interval)
521 p = psutil.Process()
522 logger.debug("PID is %d", p.pid)
523 while True:
524 with p.oneshot():
525 cpu_usage = p.cpu_percent()
526 memory_usage = p.memory_percent()
527 logger.debug("CPU usage: %s%%, Memory usage: %s%%", cpu_usage, memory_usage)
528 cpu_usage_gauge.set(cpu_usage)
529 memory_usage_gauge.set(memory_usage)
530 time.sleep(interval)
531
532
533def monitor_freshness(store: "FeatureStore", interval: int = 30):

Callers

nothing calls this directly

Calls 1

setMethod · 0.80

Tested by

no test coverage detected