Example #1
0
VimŸUnDoх–Ж˜š‘vНІвHЏ!ы+няЇеRњДŒ0Х†ш_;        logger.warn("Health Monitor failed e={}".format(e))]^q8L_аџџџџ^_Яѕ>        amdgpu_info_path = os.environ["MINARY_AMDGPU_PM_INFO"]5_аCџџџџ^_еѕBDaF            amdgpu_info_path, num_of_gpus, integrated_graphics_enabled5_аCџџџџ^_жѕa	import os/from utils import CoinmineLogger, SystemHelpers+from utils.requests import CoinmineRequestsXfrom health_monitor.docker import MinaryDocker, MinaryDockerCompose, DockerHealthChecker4from health_monitor.miner import AMDGPUHealthCheckerfrom adapters import AMDGPUInfo5from health_monitor.system import SystemHealthChecker3# from health_monitor.pool import PoolHealthChecker!logger = CoinmineLogger(__name__)if __name__ == "__main__":3    logger.info("Starting Coinmine Health Monitor")    try:!        hardreboot = "hardreboot"C        restart_minary_compose = "systemctl restart minary-compose"G        gpu_mineable_coins = ["ethereum", "zcash", "grin", "handshake"]'        cpu_mineable_coins = ["monero"]        # envsC        minary_api_server_url = os.environ["MINARY_API_SERVER_URL"]@        compose_filename = os.environ["MINARY_COMPOSE_FILENAME"]W        mem_clock_low_threshold = int(os.environ["MINARY_AMDGPU_MEMCLK_LOW_THRESHOLD"])'        mem_clock_high_threshold = int(=            os.environ["MINARY_AMDGPU_MEMCLK_HIGH_THRESHOLD"]	        )X        gpu_load_low_threshold = int(os.environ["MINARY_AMDGPU_GPU_LOAD_LOW_THRESHOLD"])T        gpu_watt_low_threshold = int(os.environ["MINARY_AMDGPU_WATT_LOW_THRESHOLD"])R        mem_percent_threshold = int(os.environ["MINARY_MEMORY_PERCENT_THRESHOLD"])$        # wait for minary_api_server        logger.info(7            "wait for minary_api_server: {}/{}".format(5                minary_api_server_url, "miner_status"
            )	        )*        SystemHelpers.wait_for_connection(V            lambda: (CoinmineRequests.test_get(minary_api_server_url, "miner_status"))	        )R        miner_status = CoinmineRequests.get(minary_api_server_url, "miner_status")'        coin = miner_status.get("coin")8        num_of_gpus = miner_status.get("num_of_gpus", 0)-        address = miner_status.get("address")3        admin_api_url = miner_status.get("api_url")1        short_uuid = miner_status.get("uuid")[:8]U        integrated_graphics_enabled = miner_status.get("integrated_graphics_enabled")        # Docker&        minary_docker = MinaryDocker())        minary_docker.initialize_client()E        minary_docker_compose = MinaryDockerCompose(compose_filename)0        oneshot_services = ["bootup_controller"]4        docker_health_checker = DockerHealthChecker(            minary_docker,"            minary_docker_compose,            oneshot_services,#            restart_minary_compose,	        )        # AMDGPU!        amdgpu_info = AMDGPUInfo(5             num_of_gpus, integrated_graphics_enabled	        )4        amdgpu_health_checker = AMDGPUHealthChecker(            amdgpu_info,            hardreboot,$            mem_clock_low_threshold,%            mem_clock_high_threshold,#            gpu_load_low_threshold,#            gpu_watt_low_threshold,            admin_api_url,            miner_status,	        )        # System4        system_health_checker = SystemHealthChecker(;            miner_status, mem_percent_threshold, hardreboot	        )        # PoolX        # pool_health_checker = PoolHealthChecker(coin, address, short_uuid, hardreboot)        # Checks%        docker_health_checker.check()%        system_health_checker.check()&        if coin in gpu_mineable_coins:)            amdgpu_health_checker.check()%        # pool_health_checker.check()    except Exception as e:;        logger.warn("Health Monitor failed e={}".format(e))3    logger.info("Finished Coinmine Health Monitor")5_а]џџџџ^q8Kѕ\^_;        logger.warn("Health Monitor failed e={}".format(e))5чЊ
Vim�UnDo��8�o�
ϖ�(����6��_v�8���,�(+9        logger.warn("No teensy device detected! Exiting")^q8�_�����^q8��+9        logger.warn("No teensy device detected! Exiting")5�_�
=����++v]���+@    minary_ambiance_server_url = os.environ["MINARY_SERVER_URL"]5�_�
4����++v]���+D    minary_ambiance_server_url = os.environ["MINARY_API_SERVER_URL"]5�_�
����++v]���+?    minary_api_server_url = os.environ["MINARY_API_SERVER_URL"]5�_�>����++v]���+N        "waiting for connection: {}/{}".format(minary_api_server_url, "state")5�_�9����++v]���+I        lambda: CoinmineRequests.test_get(minary_api_server_url, "state")5�_�0����++v]��� +@    state = CoinmineRequests.get(minary_api_server_url, "state")5�_�	"0����++v]���!#+G        teensy_interface, state, minary_api_server_url, animation_queue5�_�
	"*����v]� �,)	import os
import sysDfrom thunder_and_lightning.utils import SerialUtils, TeensyInterfacePfrom thunder_and_lightning.controllers import AmbianceController, AnimationQueue<from utils import SystemHelpers, CoinmineLogger, sentry_init+from utils.requests import CoinmineRequests
sentry_init()if __name__ == "__main__":%    logger = CoinmineLogger(__name__)?    minary_api_server_url = os.environ["MINARY_API_SERVER_URL"]5    script_path = os.environ["MINARY_TL_SCRIPT_PATH"]2    logger.info("Starting Light and Sound Worker")/    teensy_path = SerialUtils.get_teensy_port()    if not teensy_path:9        logger.warn("No teensy device detected! Exiting")        sys.exit(1)@    teensy_interface = TeensyInterface(teensy_path, script_path)&    teensy_interface.set_serial_port()W    logger.info("waiting for connection: {}/{}".format(minary_api_server_url, "state"))&    SystemHelpers.wait_for_connection(I        lambda: CoinmineRequests.test_get(minary_api_server_url, "state")    )@    state = CoinmineRequests.get(minary_api_server_url, "state")&    animation_queue = AnimationQueue()"    ambiance = AmbianceController(G        teensy_interface, state, minary_api_server_url, animation_queue    )    try:        while True:)            ambiance.run_animation_step()    except Exception as e:L        logger.error("Could not run light and sound service e={}".format(e))        sys.exit(1)5�_�	
>����v]�"��)G    state = CoinmineRequests.get(minary_api_server_url, "miner_status")5�_�
G����v]�"��)P        lambda: CoinmineRequests.test_get(minary_api_server_url, "miner_status")5��