-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for point in time #207
Changes from 7 commits
6199cb5
7d8bd09
04e6cd3
3af10ff
2f372a6
ab08098
4d9ec91
544db82
7497594
f400ed6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,8 +61,9 @@ def register_default_runners(): | |
register_runner(workload.OperationType.SubmitAsyncSearch, SubmitAsyncSearch(), async_runner=True) | ||
register_runner(workload.OperationType.GetAsyncSearch, Retry(GetAsyncSearch(), retry_until_success=True), async_runner=True) | ||
register_runner(workload.OperationType.DeleteAsyncSearch, DeleteAsyncSearch(), async_runner=True) | ||
register_runner(workload.OperationType.OpenPointInTime, OpenPointInTime(), async_runner=True) | ||
register_runner(workload.OperationType.ClosePointInTime, ClosePointInTime(), async_runner=True) | ||
register_runner(workload.OperationType.CreatePointInTime, CreatePointInTime(), async_runner=True) | ||
register_runner(workload.OperationType.DeletePointInTime, DeletePointInTime(), async_runner=True) | ||
register_runner(workload.OperationType.ListAllPointInTime, ListAllPointInTime(), async_runner=True) | ||
|
||
# This is an administrative operation but there is no need for a retry here as we don't issue a request | ||
register_runner(workload.OperationType.Sleep, Sleep(), async_runner=True) | ||
|
@@ -1848,32 +1849,46 @@ def __repr__(self, *args, **kwargs): | |
return "delete-async-search" | ||
|
||
|
||
class OpenPointInTime(Runner): | ||
class CreatePointInTime(Runner): | ||
async def __call__(self, opensearch, params): | ||
op_name = mandatory(params, "name", self) | ||
index = mandatory(params, "index", self) | ||
keep_alive = params.get("keep-alive", "1m") | ||
response = await opensearch.open_point_in_time(index=index, | ||
params=params.get("request-params"), | ||
keep_alive=keep_alive) | ||
id = response.get("id") | ||
response = await opensearch.create_point_in_time(index=index, | ||
params=params.get("request-params"), | ||
keep_alive=keep_alive) | ||
id = response.get("pit_id") | ||
CompositeContext.put(op_name, id) | ||
|
||
def __repr__(self, *args, **kwargs): | ||
return "open-point-in-time" | ||
return "create-point-in-time" | ||
|
||
|
||
class ClosePointInTime(Runner): | ||
class DeletePointInTime(Runner): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I remember us discussing to have deleteAllPointInTime outside composite context - lets see if we can add that as well to code repository. |
||
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 = {"id": pit_id} | ||
await opensearch.close_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=True, 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" | ||
|
||
|
||
class ListAllPointInTime(Runner): | ||
async def __call__(self, opensearch, params): | ||
request_params = params.get("request-params", {}) | ||
await opensearch.list_all_point_in_time(params=request_params, headers=None) | ||
|
||
def __repr__(self, *args, **kwargs): | ||
return "close-point-in-time" | ||
return "list-all-point-in-time" | ||
|
||
|
||
class CompositeContext: | ||
|
@@ -1925,9 +1940,11 @@ class Composite(Runner): | |
def __init__(self, *args, **kwargs): | ||
super().__init__(*args, **kwargs) | ||
self.supported_op_types = [ | ||
"open-point-in-time", | ||
"close-point-in-time", | ||
"create-point-in-time", | ||
"delete-point-in-time", | ||
"list-all-point-in-time", | ||
"search", | ||
"paginated-search", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where it the code for this ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code for paginated-search functionality is already present in the code base, though the paginated-search was not enabled for |
||
"raw-request", | ||
"sleep", | ||
"submit-async-search", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we confirm none of the workloads here do not use these operations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I have checked and verified that these operations are not called in the workloads repo as of now