Skip to content

Commit 9462003

Browse files
committed
Merge branch 'progress' into dev
2 parents c5becaa + 4f793fa commit 9462003

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ before_install:
2222
install:
2323
- pip install --pre -r jupyterhub/dev-requirements.txt
2424
- pip install --pre -e jupyterhub
25+
- pip install --pre -f travis-wheels/wheelhouse -r requirements.txt
2526

2627
script:
2728
- travis_retry py.test --lf --cov batchspawner batchspawner/tests -v

batchspawner/batchspawner.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@
1515
* remote execution via submission of templated scripts
1616
* job names instead of PIDs
1717
"""
18+
import asyncio
19+
from async_generator import async_generator, yield_, yield_from_
1820
import pwd
1921
import os
20-
import asyncio
2122
import re
23+
import sys
2224

2325
import xml.etree.ElementTree as ET
2426

@@ -407,6 +409,23 @@ async def stop(self, now=False):
407409
self.job_id, self.ip, self.port)
408410
)
409411

412+
@async_generator
413+
async def progress(self):
414+
while True:
415+
if self.state_ispending():
416+
await yield_({
417+
"message": "Pending in queue...",
418+
})
419+
elif self.state_isrunning():
420+
await yield_({
421+
"message": "Cluster job running... waiting to connect",
422+
})
423+
return
424+
else:
425+
await yield_({
426+
"message": "Unknown status...",
427+
})
428+
await gen.sleep(.1)
410429

411430
class BatchSpawnerRegexStates(BatchSpawnerBase):
412431
"""Subclass of BatchSpawnerBase that uses config-supplied regular expressions

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
async_generator>=1.8
12
jinja2
23
jupyterhub>=0.5

0 commit comments

Comments
 (0)