Fix version conflicts when deleting task events cause an error

This commit is contained in:
allegroai 2022-02-13 20:01:25 +02:00
parent 447adb9090
commit a25cd5dae8
2 changed files with 6 additions and 6 deletions

View File

@ -66,7 +66,9 @@ def delete_company_events(
es: Elasticsearch, company_id: str, event_type: EventType, body: dict, **kwargs es: Elasticsearch, company_id: str, event_type: EventType, body: dict, **kwargs
) -> dict: ) -> dict:
es_index = get_index_name(company_id, event_type.value) 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( def count_company_events(
@ -76,9 +78,7 @@ def count_company_events(
return es.count(index=es_index, body=body, **kwargs) return es.count(index=es_index, body=body, **kwargs)
def get_metric_variants_condition( def get_metric_variants_condition(metric_variants: MetricVariants,) -> Sequence:
metric_variants: MetricVariants,
) -> Sequence:
conditions = [ conditions = [
{ {
"bool": { "bool": {

View File

@ -10,12 +10,12 @@ from typing import (
from redis import StrictRedis from redis import StrictRedis
from apiserver.config_repo import config 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.redis_manager import redman
from apiserver.utilities.dicts import nested_get from apiserver.utilities.dicts import nested_get
from apiserver.utilities.parameter_key_escaper import ParameterKeyEscaper from apiserver.utilities.parameter_key_escaper import ParameterKeyEscaper
from .sub_projects import _ids_with_children from .sub_projects import _ids_with_children
from ...database.model.model import Model
from ...database.model.task.task import Task
log = config.logger(__file__) log = config.logger(__file__)