Renamed the project to 'Bg'
This commit is contained in:
13
README.md
13
README.md
@@ -1,13 +1,10 @@
|
|||||||
# Go-Do
|
# Bg
|
||||||
Implement a simple way to "toss" a job to be run
|
Implement a class to run a simple job "in the background", in parallel, and have the result waiting when the job is done.
|
||||||
in parallel with your main application logic
|
|
||||||
and when you're ready to use the results of
|
|
||||||
that job query if it's finished.
|
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from go_do import Do
|
from bg import Bg
|
||||||
|
|
||||||
## From a docker hub api bit of code.
|
## From a docker hub api bit of code.
|
||||||
|
|
||||||
@@ -17,13 +14,13 @@ def get_all(url):
|
|||||||
while 200 <= int(rsp.getcode()) < 300:
|
while 200 <= int(rsp.getcode()) < 300:
|
||||||
data = json.loads(rsp.read())
|
data = json.loads(rsp.read())
|
||||||
url = data.get("next")
|
url = data.get("next")
|
||||||
next = Do(urllib.request.urlopen, url) if url else None
|
next = Bg(urllib.request.urlopen, url) if url else None
|
||||||
for item in data['results']:
|
for item in data['results']:
|
||||||
yield item
|
yield item
|
||||||
if next is None:
|
if next is None:
|
||||||
break
|
break
|
||||||
# If the result is not ready yet, wait for it.
|
# If the result is not ready yet, wait for it.
|
||||||
rsp = next.wait_for_it()
|
rsp = next.wait()
|
||||||
print("Done")
|
print("Done")
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user