Skip to content

Commit

Permalink
Squash merge bugfix-broken-api into main
Browse files Browse the repository at this point in the history
  • Loading branch information
langdal committed Nov 18, 2024
1 parent 50f33d4 commit f6ca98a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions optimizerapi/optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def disconnect_check():
except NoSuchJobError:
print("Creating new job")
job = queue.enqueue(do_run_work, body, job_id=job_id, result_ttl=TTL)
while job.return_value is None:
while job.return_value() is None:
if disconnect_check():
try:
print(f"Client disconnected, cancelling job {job.id}")
Expand All @@ -89,7 +89,7 @@ def disconnect_check():
pass
return {}
time.sleep(0.2)
return job.return_value
return job.return_value()
return do_run_work(body)


Expand Down
8 changes: 4 additions & 4 deletions optimizerapi/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Worker that will run all tasks published to redis using RQ
"""
import os
from rq import Connection, Queue, Worker
from rq import Queue, Worker
from redis import Redis


Expand All @@ -12,6 +12,6 @@
REDIS_URL = "redis://localhost:6379"

if __name__ == "__main__":
with Connection(Redis.from_url(REDIS_URL)):
queue = Queue()
Worker(queue).work()
redis = Redis.from_url(REDIS_URL)
queue = Queue(connection=redis)
Worker(queue).work()
2 changes: 1 addition & 1 deletion requirements-freeze.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ PyYAML==6.0
redis==4.5.4
requests==2.28.2
requests-toolbelt==0.10.1
rq==1.16.2
rq==2.0.0
rsa==4.9
scikit-learn==1.1.2
scipy==1.9.1
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ json-tricks==3.15.5
jsonschema==4.15.0
cryptography==3.4.7
waitress==2.1.2
rq==1.16.2
rq==2.0.0
# ProcessOptimizer requirements
numpy==1.23.3
matplotlib==3.5.3
Expand Down

0 comments on commit f6ca98a

Please sign in to comment.