CoolFace
Apppublic

SRINIVASAN-AI-DEV/cloud-chaos-healer

sourceHugging Facemitupdated 6mo agoView on Hugging Face
0likes
client.cpython-313.pyc57 linesDownload Raw Back to __pycache__
1�

2'B�i���SrSSKJr SSKJr SSKJr SSKJr SSK	J3r4Jr "SS	\\5\\45r
g6!\a SSK	J7r8Jr N"f=f)z&Cloud Chaos Healer Environment Client.�)�Dict)�	EnvClient)�9StepResult)�State�)�CcHealerAction�CcHealerObservationc�T�\rSrSrSrS\S\4SjrS\S\\	4Sjr10S\S\4SjrS	r
g11)�CcHealerEnv�a(12Client for the Cloud Chaos Healer Environment.13 14Connects via WebSocket to the environment server to facilitate 15low-latency SRE action loops . The agent monitors system 16metrics and executes corrective commands to maintain uptime .17 18Example:19    >>> with CcHealerEnv(base_url="http://localhost:8000") as client:20    ...     result = client.reset(task_id="medium")21    ...     print(result.observation.logs)22    ...     result = client.step(CcHealerAction(command="scale_gateway"))23    ...     print(f"Current Latency: {result.observation.latency}ms")24�action�returnc��SUR0$)zj25Convert CcHealerAction to JSON payload.26Ensures the command field is correctly serialized for the server27�command)r)�selfr
s  �$D:\Meta\cloud_chaos_healer\client.py�
_step_payload�CcHealerEnv._step_payload)s��
�v�~�~�28�	29��payloadc�z�URS05n[URSS5URSS5URSS5URSS	5URS30S5URSS5URS
S5S9n[UURS
S5URSS5S9$)zl31Parse server response into CcHealerObservation.32Maps real-world SRE metrics including budget and latency .33�observation�logs��
system_status�UNKNOWN�latencyg�remaining_budgetg@�@�task_id�doneF�reward)rrrrrr r!)rr!r )�getr	r)rr�obs_datars    r�
_parse_result�CcHealerEnv._parse_result2s���34�;�;�}�b�1��)����f�b�)�"�,�,��	�B��L�L��C�0�%�\�\�*<�f�E��L�L��B�/����V�U�+��;�;�x��-�35���#��;�;�x��-����V�U�+�36�	37rc�T�[URS5URSS5S9$)zr38Parse server response into OpenEnv State.39Tracks the episode progress across the 25 concurrent sessions allowed.40�41episode_id�42step_countr)r'r()rr")rrs  r�_parse_state�CcHealerEnv._parse_stateGs+��43��{�{�<�0��{�{�<��3�44�	45r�N)�__name__�46__module__�__qualname__�__firstlineno__�__doc__rrrrr	r$rr)�__static_attributes__r+rrrrsF��
�47�N�48�t�49�50�T�51�j�9L�.M�52�*53�D�54�U�55rrN)r0�typingr�openenv.corer�openenv.core.client_typesr�openenv.core.env_server.typesr�modelsrr	�ImportErrorrr+rr�<module>r8sO��-��"�0�/�;�;�856�
�n�1�5�8�9�857���;�:�:�;�s�6�A�A