From f0ebeb3ffbc9aaf036fc6b7315d43cad0ba951c9 Mon Sep 17 00:00:00 2001 From: Ankit R Gadiya Date: Wed, 23 Oct 2024 11:35:50 +0530 Subject: [PATCH] feat(device): implement RefreshPollerMixin for Device class (#84) The Device class extends the RefreshPollerMixin class. We implemented the is_ready() method that enables the poll_till_ready method. This method can no be used to wait for a device until it is online. --- rapyuta_io/clients/device.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rapyuta_io/clients/device.py b/rapyuta_io/clients/device.py index 46d74f48..5fb026dc 100644 --- a/rapyuta_io/clients/device.py +++ b/rapyuta_io/clients/device.py @@ -22,6 +22,7 @@ from rapyuta_io.utils.utils import create_auth_header, get_error, get_api_response_data, \ validate_key_value, response_validator, is_true from rapyuta_io.utils.partials import PartialMixin +from rapyuta_io.utils.pollers import RefreshPollerMixin DEVICE_API_ERRORS = { 400: ParameterMissingException, @@ -217,7 +218,7 @@ def __str__(self): PYTHON3 = '3' -class Device(PartialMixin, ObjDict): +class Device(PartialMixin, RefreshPollerMixin, ObjDict): """ Device class represents a device. Member variables of the class represent the properties of device. \n @@ -350,6 +351,9 @@ def is_online(self): return True return False + def is_ready(self): + return self.is_online() + def get_runtime(self): """ Get the device runtime