From a25cd5dae81ad3cb7438ef630aa345b3ac7e130c Mon Sep 17 00:00:00 2001 From: allegroai <> Date: Sun, 13 Feb 2022 20:01:25 +0200 Subject: [PATCH] Fix version conflicts when deleting task events cause an error --- apiserver/bll/event/event_common.py | 8 ++++---- apiserver/bll/project/project_queries.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apiserver/bll/event/event_common.py b/apiserver/bll/event/event_common.py index c0493e0..5f89549 100644 --- a/apiserver/bll/event/event_common.py +++ b/apiserver/bll/event/event_common.py @@ -66,7 +66,9 @@ def delete_company_events( es: Elasticsearch, company_id: str, event_type: EventType, body: dict, **kwargs ) -> dict: es_index = get_index_name(company_id, event_type.value) - return es.delete_by_query(index=es_index, body=body, **kwargs) + return es.delete_by_query( + index=es_index, body=body, conflicts="proceed", **kwargs + ) def count_company_events( @@ -76,9 +78,7 @@ def count_company_events( return es.count(index=es_index, body=body, **kwargs) -def get_metric_variants_condition( - metric_variants: MetricVariants, -) -> Sequence: +def get_metric_variants_condition(metric_variants: MetricVariants,) -> Sequence: conditions = [ { "bool": { diff --git a/apiserver/bll/project/project_queries.py b/apiserver/bll/project/project_queries.py index ea9605b..1c7197b 100644 --- a/apiserver/bll/project/project_queries.py +++ b/apiserver/bll/project/project_queries.py @@ -10,12 +10,12 @@ from typing import ( from redis import StrictRedis from apiserver.config_repo import config +from apiserver.database.model.model import Model +from apiserver.database.model.task.task import Task from apiserver.redis_manager import redman from apiserver.utilities.dicts import nested_get from apiserver.utilities.parameter_key_escaper import ParameterKeyEscaper from .sub_projects import _ids_with_children -from ...database.model.model import Model -from ...database.model.task.task import Task log = config.logger(__file__)