Skip to content

Commit

Permalink
Fix: invalidate cache before status check
Browse files Browse the repository at this point in the history
remove duplicate args for run_connector
  • Loading branch information
sp35 committed Jul 12, 2021
1 parent 1f9cd48 commit 8aad3c2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions api_app/connectors_manager/controller.py
Expand Up @@ -91,14 +91,14 @@ def start_connectors(
celery_app.send_task(
CELERY_TASK_NAME,
args=args,
kwargs={"job_id": job_id, "runtime_conf": runtime_conf, **celery_kwargs},
kwargs={"runtime_conf": runtime_conf, **celery_kwargs},
queue=queue,
soft_time_limit=stl,
task_id=task_id,
)

# cache the task ids
cache.set(build_cache_key(job_id), connectors_task_id_map.values())
cache.set(build_cache_key(job_id), list(connectors_task_id_map.values()))

return connectors_task_id_map

Expand Down
4 changes: 3 additions & 1 deletion intel_owl/tasks.py
Expand Up @@ -71,7 +71,9 @@ def run_analyzer(job_id: int, config_dict: dict, **kwargs):
# run analyzer
instance = analyzers_controller.run_analyzer(job_id, config_dict, **kwargs)
# fire connectors when job finishes with success
if instance and instance._job.status == "reported_without_fails":
if instance and instance._job:
del instance._job # invalidate cache
if instance._job.status == "reported_without_fails":
app.send_task(
"on_job_success",
args=[
Expand Down

0 comments on commit 8aad3c2

Please sign in to comment.