Skip to content

Commit 359dd69

Browse files
committed
Sweep the tree and switch to is_*() methods across Thread and Thread.Event.
The Thread isAlive() method was deprecated in Python 3.8 and removed from 3.9. While doing this also noted that the old alias for is_set() is also marked as deprecated so also preemptively switch that over. Doing so for both makes calls to those APIs consistent.
1 parent 625b732 commit 359dd69

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

mig/server/grid_script.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def time_out_jobs(stop_event):
9797
# Keep running until main sends stop signal
9898

9999
counter = 0
100-
while not stop_event.isSet():
100+
while not stop_event.is_set():
101101
counter = (counter + 1) % 60
102102

103103
# Responsive sleep for 60 seconds
@@ -1706,7 +1706,7 @@ def graceful_shutdown():
17061706
elif cap_line.find('CHECKTIMEOUTTHREAD') == 0:
17071707
logger.info('--- CHECKING TIME OUT THREAD ---')
17081708
logger.info('--- TIME OUT THREAD IS ALIVE: %s ---'
1709-
% job_time_out_thread.isAlive())
1709+
% job_time_out_thread.is_alive())
17101710
elif cap_line.find('RELOADCONFIG') == 0:
17111711
logger.info('--- RELOADING CONFIGURATION ---')
17121712
configuration.reload_config(True)
@@ -1727,11 +1727,11 @@ def graceful_shutdown():
17271727

17281728
# TMP: Auto restart time out thread until we find the death cause
17291729

1730-
if not job_time_out_thread.isAlive():
1730+
if not job_time_out_thread.is_alive():
17311731
logger.warning('--- TIME OUT THREAD DIED: %s %s %s---'
17321732
% (job_time_out_thread,
1733-
job_time_out_thread.isAlive(),
1734-
job_time_out_stop.isSet()))
1733+
job_time_out_thread.is_alive(),
1734+
job_time_out_stop.is_set()))
17351735
logger.info('ressurect time out thread with executing queue:')
17361736
logger.info('%s' % executing_queue.show_queue(['ALL']))
17371737
job_time_out_stop.clear()

mig/server/sftp_subsys.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ def get_transport(self):
259259
# Join with 1s timeout to stay responsive but catch finish
260260
sftp_server.join(1)
261261
# Check alive to decide if join succeeded or timed out
262-
if not sftp_server.isAlive():
262+
if not sftp_server.is_alive():
263263
# logger.debug(
264264
# '(%d) Joined sftp subsys server worker' % pid)
265265
configuration.daemon_conf['stop_running'].set()

mig/shared/functionality/sharelink.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ def main(client_id, user_arguments_dict):
334334
logger.debug('check done %s' % invite_list[i])
335335
notify = threads[i]
336336
notify.join(3)
337-
notify_done[i] = not notify.isAlive()
337+
notify_done[i] = not notify.is_alive()
338338
notify_sent, notify_failed = [], []
339339
for i in range(len(invite_list)):
340340
if notify_done[i]:

mig/shared/worker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def dummy_test(delay):
4747

4848
def throttle_max_concurrent(workers, concurrent=__max_concurrent):
4949
"""Wait until at most max_concurrent workers are active"""
50-
while len([w for w in workers if w.isAlive()]) >= concurrent:
50+
while len([w for w in workers if w.is_alive()]) >= concurrent:
5151
time.sleep(1)
5252
return
5353

0 commit comments

Comments
 (0)