Permalink
Browse files

Run tasks in the background using RQ. This closes #67 and could impact

  • Loading branch information...
1 parent 8dbf3df commit 0b9c02adbb0a0db32865ea4d1d6a674d5d79a47a @harishvc committed Oct 21, 2015
Showing with 21 additions and 8 deletions.
  1. +13 −6 .travis.yml
  2. +1 −0 Procfile
  3. +2 −2 RunFlask.py
  4. +1 −0 requirements.txt
  5. +4 −0 worker.py
View
@@ -1,16 +1,23 @@
-#source: http://docs.travis-ci.com/user/languages/python/
language: python
python:
- - "2.7"
+- '2.7'
env:
global:
- - secure: driiFkngxIL3rMaU30qXUsOZqmtBjsuMphDxHYWLehKVvVzfKkr76r0g7dcdLP+BWYzFc+L/r7sSHWZ21mdKDc/q/B8przX4RA5tK5zE4yHZmtovFplZt3NbW0WTOd3IKxKGjzZ9LzYP7/L1O8rD3OnmMhtmNYlK2b5+nq/BR3/n+Y+Y8GyVzuse6TylZ/4B4fYYqP5eBrTqWr470mEj/J9knyzyfqeGUPJd4eQvyx4u64Ff/n9xK7Q5B/jh6dc3FAwaHv7aDQGo1diP/U+rmv0VuYUKjbAAXFZ31gwozV9qbmS8eqxrfB9YbECZyJeoMQ1DE3Ajf9e9Mg3nJD3/RaJNPshcxCLEFmbQf/rcuATOR2F4iGbW0UsCS/9636vp8CEM0/9gYSiMjuQCOxdHEXxrGHcPWCT81a4ahZTrNCS2CjC4LgXYgpYFjpqAkeC2Cc/54gQ8o+mrOfrTDmVRIPOOKUYzbKEqGO6qyr+PkbhxxHm/x/gIkIc2E6ju8lbZVaxsiGkFQoT5tEI5R7nvu1bv0Xqp6tSqLJ8SRmBrAIbaDfopWJVwinO0Z/WbYWw5agy2egJOqTWhBsRQFwKOW8dC3/3Lg/OIcm2IvyMMnTPvKCHn6lKUDM1dy+G0mkkkUwQYFJBi9S2ZrIhx7FOyM5W/mykRHPoDS4HHSm5lp2s=
- - secure: ijQGcdwBl77mwnlyseHZWo2hJi8pv1rBE9Vpc1fzjoloUqdTYUJ8bK74rxpkXAlIe16Ou7tFV2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qAkeC2Cc/54gQ8o+mrOfrTDmVRIPOOKUYzbKEqGO6qyr+PkbhxxHm/x/gIkIc2E6ju8lbZVaxsiGkFQoT5tEI5R7nvu1bv0Xqp6tSqLJ8SRmBrAIbaDfopWJVwinO0Z/WbYWw5agy2egJOqTWhBsRQFwKOW8dC3/3Lg/OIcm2IvyMMnTPvKCHn6lKUDM1dy+G0mkkkUwQYFJBi9S2ZrIhx7FOyM5W/mykRHPoDS4HHSm5lp2s=
+ - secure: ijQGcdwBl77mwnlyseHZWo2hJi8pv1rBE9Vpc1fzjoloUqdTYUJ8bK74rxpkXAlIe16Ou7tFV2GZDsBRk6Yk+GbcX7/KgMUNVu66KwWTfY6bNPZsaK28y0VQ+807w2Q3mQDjFv3VlzCJGiyKXvyXGg7QuSsgNDO0nZxsRJ6Mz6FlU8yTvJykZvGKs6Dk4HoCYetV1uwaeEJaDADAwzENqSjiMJZiJkCE3cRos42GhRMBZgUPsXgXZKQ0gWUufcL/IRD4ncDdLNiLOtLqBGa46uw+ZN8vkA27ea0HmYlcyvQ+RyrjhB1eUUNXjPKvDqWQsS1Ohv1xaYzEg5gFgQ+ujPpFYN63Wnqbe0x0sr8O1yhx2mHslXe3wfB+KUnD+Li7UajLcHQrT2S6BGz4ywidhhJnLbwjs2e7r5p1yg1hFfAnhzk1W2kuClwuGF0K/RuiiXtWus+1GGgtOqGuXjWqX8b+MB/bSvJDb6VaxlPO2keUlolsd6on7wQjCWUKzaUd11P5vBsAZ+55y0L7yPHOInW2DoNjlQI+YHPSbdnpJXBXkevWNzowF/lG0cn0FjoF/NDjVuQJTz5Zb7tG23JVATtxIJrqJ9dcx/Y9l22WO+1zBekIL7uitC6ZeDmaveZCGYZtH+oUWcn5G8zVVepDT70QrKvANRKB0kFP7A6nyN8=
addons:
sauce_connect: true
+services:
+ - redis-server
before_script:
- - python RunFlask.py &
+- python RunFlask.py worker.py &
+- python worker.py &
script: python test/travis-testcases.py
branches:
only:
- - master
+ - master
+deploy:
+ provider: heroku
+ api_key:
+ secure: EwV1/pUlwPl23xxSFqCRs6TCJ9qharRrAEVEKm8Uyar4Fy+yFd07wu4JEuZAvzVeWWm7tQH6D2spqpuazDkEKt5xwFor0sIR3tSfgARvEyQ99CdzjkNH8Qu++g3xx9MWBr0ClTJCI6HEVZ6i5k/k2jCBU51J4y3KQA1pr7aDp008Pd/wb5dEGxcqj6zUkt+Wd7DemPbBkOmufBiFtDpOxizb0gkuSLyl1iLJPOtsx5bPP+Dr65EImCgyzlwGU9Mjxy98MfC+bvrqlI1SYKMSJfHOZTAkJM2bFOsG43EjVPLbPP/rphjKdxphlZLd9kFVT0ofOvYMGrpAK2yHWAl+V47gA5EPwNwOKIQ+MppOryftyIoVI3/b7qkD+ZJqBVbQ6HhOtJKcm33iFJGz6HvDstQ4w2w5Vi26vrRnjOhRipnVfNWnANca5o/meOg4GqiqFMey9a6Bbg0vIdNz9WNkXnRk8EW5fo7TquyKYd9EWfZpfpB/IXBU5x/UK8Iy109z3TvZ5VJIBXaaKKGIeEdh+DneS+t4JqjsXKZqmqiEguvQXOit/PlBwAFgUgI+9oetOFBdlzlg7/snPBcWnu7vy/8dgzInZtMw8K71TVLYCdlDfIQBkYdahK+Jbb01C+j6Ax5WsKQgS3u5PN26xbC3CEEMpRbYaCwsXkhuGcZTr3w=
+ app: rocky-hamlet-2442
View
@@ -1 +1,2 @@
web: python RunFlask.py $ProcFlags
+worker: python worker.py
View
@@ -102,11 +102,11 @@ def index():
@app.route('/_findsimilarrepositories')
def findsimilarrepositories():
reponame = bleach.clean(request.args['a']).strip()
- print("staring queue ...")
+ #print("staring queue ...")
SR = BQ.enqueue(FindSimilarRepositories,reponame)
while SR.result is None:
time.sleep(1)
- print("ending queue .....")
+ #print("ending queue .....")
return jsonify(similarrepos=SR.result)
@app.route('/_listlanguages')
View
@@ -17,5 +17,6 @@ pytz==2014.4
python-Levenshtein==0.12.0
flask-paginate==0.3.0
rq==0.5.4
+redis==2.10.3
selenium==2.47.3
sauceclient==0.2.1
View
@@ -1,3 +1,5 @@
+#https://devcenter.heroku.com/articles/python-rq
+
import os
import redis
from rq import Worker, Queue, Connection
@@ -8,6 +10,8 @@
redis_url = os.getenv('REDISTOGO_URL', 'redis://127.0.0.1:6379')
+#print("Redis URL ====", redis_url)
+
conn = redis.from_url(redis_url)
if __name__ == '__main__':

0 comments on commit 0b9c02a

Please sign in to comment.