From b595f46bfd275b5defd79725e2744fe12ce928a0 Mon Sep 17 00:00:00 2001 From: Arpit Bandejiya Date: Tue, 23 Aug 2022 16:11:25 +0530 Subject: [PATCH] delete pit to be used without composite --- osbenchmark/worker_coordinator/runner.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/osbenchmark/worker_coordinator/runner.py b/osbenchmark/worker_coordinator/runner.py index 6835bf161..a4dfea42b 100644 --- a/osbenchmark/worker_coordinator/runner.py +++ b/osbenchmark/worker_coordinator/runner.py @@ -1866,14 +1866,17 @@ def __repr__(self, *args, **kwargs): class DeletePointInTime(Runner): async def __call__(self, opensearch, params): - pit_op = mandatory(params, "with-point-in-time-from", self) - pit_id = CompositeContext.get(pit_op) + pit_op = params.get("with-point-in-time-from", None) request_params = params.get("request-params", {}) - body = { - "pit_id": [pit_id] - } - await opensearch.delete_point_in_time(body=body, params=request_params, headers=None) - CompositeContext.remove(pit_op) + if pit_op is None: + await opensearch.delete_point_in_time(all="_all", params=request_params) + else: + pit_id = CompositeContext.get(pit_op) + body = { + "pit_id": [pit_id] + } + await opensearch.delete_point_in_time(body=body, params=request_params, headers=None) + CompositeContext.remove(pit_op) def __repr__(self, *args, **kwargs): return "delete-point-in-time"