Skip to content

Use is_alive instead of isAlive for Python 3.9 compatibility. #162

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions enginecore/enginecore/state/hardware/room.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def _launch_thermal_thread(self, name, th_kwargs):
def _init_voltage_thread(self):
"""Initialize voltage fluctuations threading"""

if self._voltage_fluct_t and self._voltage_fluct_t.isAlive():
if self._voltage_fluct_t and self._voltage_fluct_t.is_alive():
logger.warning("Voltage thread is already running!")
return

Expand Down Expand Up @@ -217,17 +217,17 @@ def __str__(self):
horizontal_line = "-" * 20

th_warming_status = (
"up" if self._temp_warming_t.isAlive() else "down",
"up" if self._temp_warming_t.is_alive() else "down",
"enabled" if not wall_power_status else "disabled",
)

th_cooling_status = (
"up" if self._temp_cooling_t.isAlive() else "down",
"up" if self._temp_cooling_t.is_alive() else "down",
"enabled" if wall_power_status else "disabled",
)

th_voltage_status = (
"up" if self._voltage_fluct_t.isAlive() else "down",
"up" if self._voltage_fluct_t.is_alive() else "down",
"enabled" if wall_power_status and volt_props["enabled"] else "disabled",
)

Expand Down
2 changes: 1 addition & 1 deletion enginecore/enginecore/state/hardware/server_asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ def stop(self, code=None):
self._sensor_repo.stop()
self._stop_event.set()

if self._vm_monitor_t is not None and self._vm_monitor_t.isAlive():
if self._vm_monitor_t is not None and self._vm_monitor_t.is_alive():
self._vm_monitor_t.join()

super().stop(code)
Expand Down
10 changes: 5 additions & 5 deletions enginecore/enginecore/state/hardware/ups_asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def _launch_battery_drain(
):
"""Start a thread that will decrease battery level"""

if self._battery_drain_t and self._battery_drain_t.isAlive():
if self._battery_drain_t and self._battery_drain_t.is_alive():
logger.warning("Battery drain is already running!")
self.state.update_transfer_reason(t_reason)
self._increase_transfer_severity()
Expand Down Expand Up @@ -254,7 +254,7 @@ def _launch_battery_drain(
def _launch_battery_charge(self, power_up_on_charge=False):
"""Start a thread that will charge battery level"""

if self._battery_charge_t and self._battery_charge_t.isAlive():
if self._battery_charge_t and self._battery_charge_t.is_alive():
logger.warning("Battery is already charging!")
return

Expand Down Expand Up @@ -426,12 +426,12 @@ def on_input_voltage_down(self, event, *args, **kwargs):
@property
def draining_battery(self):
"""Returns true if UPS battery is being drained"""
return self._battery_drain_t is not None and self._battery_drain_t.isAlive()
return self._battery_drain_t is not None and self._battery_drain_t.is_alive()

@property
def charging_battery(self):
"""Returns true if UPS battery is getting re-charged"""
return self._battery_charge_t is not None and self._battery_charge_t.isAlive()
return self._battery_charge_t is not None and self._battery_charge_t.is_alive()

@property
def charge_speed_factor(self):
Expand Down Expand Up @@ -476,7 +476,7 @@ def stop(self, code=None):
self._stop_event.set()

for thread in [self._battery_charge_t, self._battery_drain_t]:
if thread is not None and thread.isAlive():
if thread is not None and thread.is_alive():
thread.join()

super().stop(code)