From 6269ae3b1fdc4c9d6df66d969cd62e2dd5e20dea Mon Sep 17 00:00:00 2001 From: Gustavo Cordova Date: Sat, 20 Jun 2020 19:03:55 -0700 Subject: [PATCH] Renamed the project to 'Bg' --- README.md | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 8ce2d31..e6fabb1 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,10 @@ -# Go-Do -Implement a simple way to "toss" a job to be run -in parallel with your main application logic -and when you're ready to use the results of -that job query if it's finished. +# Bg +Implement a class to run a simple job "in the background", in parallel, and have the result waiting when the job is done. Example: ```python -from go_do import Do +from bg import Bg ## From a docker hub api bit of code. @@ -15,15 +12,15 @@ def get_all(url): "Retrieve all paged results" rsp = urllib.request.urlopen(url) while 200 <= int(rsp.getcode()) < 300: - data = json.loads(rsp.read()) - url = data.get("next") - next = Do(urllib.request.urlopen, url) if url else None - for item in data['results']: - yield item - if next is None: - break - # If the result is not ready yet, wait for it. - rsp = next.wait_for_it() + data = json.loads(rsp.read()) + url = data.get("next") + next = Bg(urllib.request.urlopen, url) if url else None + for item in data['results']: + yield item + if next is None: + break + # If the result is not ready yet, wait for it. + rsp = next.wait() print("Done") ```