Skip to content

Commit

Permalink
change to an dynamic import to avoid circular imports
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Gebhardt authored and Tom Gebhardt committed Nov 21, 2023
1 parent 7da6d69 commit f4da5bc
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions app/celery/automated_tasks/csh_fair.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from .csh_helpers import check_route
from app.dependencies.settings import get_settings
from ... import models
#from ... import models

from app.celery.celery_app import app

Expand All @@ -18,21 +18,23 @@ def is_doi(identifier):



def incoperate_results(task_dict: dict, result: ["success","failed","warning"], test: bool):
def incoperate_results(task_dict: dict, result: 'app.models.TaskStatus', test: bool):
import app.models #dynamic import

print("incoperate results!")
session_id = task_dict["session_id"]
task_id = task_dict["id"]

print(config.celery_key)
status = models.TaskStatusIn(
status=models.TaskStatus(result), force_update=config.celery_key
status = app.models.TaskStatusIn(
status= app.models.TaskStatus(result), force_update=config.celery_key
)

print(f"Task status computed: {result}")
# Needs to send a request for the task to be updated
if test:
print("test is true")
return models.TaskStatus(result)
return app.models.TaskStatus(result)
else:
url = f"http://{config.backend_url}:{config.backend_port}/session/{session_id}/tasks/{task_id}"
print(f"Patching {url}")
Expand Down

0 comments on commit f4da5bc

Please sign in to comment.