35 lines
1.2 KiB
Python
35 lines
1.2 KiB
Python
"""
|
|
Pipeline feedback — feeds execution results back into the policy engine
|
|
so it can learn which nodes / actions succeed vs fail.
|
|
|
|
Currently the PolicyEngine doesn't have a `update_reputation` method
|
|
(see backend/policy/engine.py for the simplified evaluate() interface).
|
|
This module is kept as a stub for future learning-loop work.
|
|
"""
|
|
|
|
from backend.policy.engine import PolicyEngine
|
|
|
|
# Singleton policy engine (db=None — no learning yet)
|
|
policy = PolicyEngine(db=None)
|
|
|
|
|
|
def report_execution(node, action, success, duration, temp_before, temp_after):
|
|
"""Feed execution results back to the policy engine.
|
|
|
|
In the future this should update per-node reputation scores so the
|
|
scheduler can prefer nodes that historically succeed and avoid nodes
|
|
that overheat. For now it's a no-op logging shim.
|
|
"""
|
|
thermal_spike = (temp_after - temp_before) > 0.15
|
|
|
|
# Future: policy.update_reputation(node, success, duration, thermal_spike)
|
|
# For now, just return the assessment
|
|
return {
|
|
"node": node,
|
|
"action": action,
|
|
"success": success,
|
|
"duration": duration,
|
|
"thermal_spike": thermal_spike,
|
|
"temp_delta": temp_after - temp_before,
|
|
}
|