Skip to content

Commit d442d74

Browse files
committed
maint: switch from tornado.gen.sleep to asyncio.sleep
1 parent 224ec3e commit d442d74

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

batchspawner/batchspawner.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626

2727
from jinja2 import Template
2828

29-
from tornado import gen
30-
3129
from jupyterhub.spawner import Spawner
3230
from traitlets import Integer, Unicode, Float, Dict, default
3331

@@ -448,11 +446,11 @@ async def start(self):
448446
" while pending in the queue or died immediately"
449447
" after starting."
450448
)
451-
await gen.sleep(self.startup_poll_interval)
449+
await asyncio.sleep(self.startup_poll_interval)
452450

453451
self.ip = self.state_gethost()
454452
while self.port == 0:
455-
await gen.sleep(self.startup_poll_interval)
453+
await asyncio.sleep(self.startup_poll_interval)
456454
# Test framework: For testing, mock_port is set because we
457455
# don't actually run the single-user server yet.
458456
if hasattr(self, "mock_port"):
@@ -481,7 +479,7 @@ async def stop(self, now=False):
481479
status = await self.query_job_status()
482480
if status not in (JobStatus.RUNNING, JobStatus.UNKNOWN):
483481
return
484-
await gen.sleep(1.0)
482+
await asyncio.sleep(1)
485483
if self.job_id:
486484
self.log.warning(
487485
"Notebook server job {0} at {1}:{2} possibly failed to terminate".format(
@@ -498,7 +496,7 @@ async def progress(self):
498496
return
499497
else:
500498
yield {"message": "Unknown status..."}
501-
await gen.sleep(1)
499+
await asyncio.sleep(1)
502500

503501

504502
class BatchSpawnerRegexStates(BatchSpawnerBase):

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
extras_require={
4242
"test": [
4343
"pytest",
44+
"pytest-asyncio",
4445
"pytest-cov",
4546
],
4647
},

0 commit comments

Comments
 (0)