Merged
Conversation
… methods from ModelsAction and ResolutionAction to a new BulkAction class. No new integration tests yet. Existing integration tests are passing, and manual tests show promise.
…n of inputs on model management.
…arallel), and each operation should neither wait for nor force a refresh.
… methods from ModelsAction and ResolutionAction to a new BulkAction class. No new integration tests yet. Existing integration tests are passing, and manual tests show promise.
…n of inputs on model management.
…arallel), and each operation should neither wait for nor force a refresh.
…ntity-io/zentity into feature-bulk-model-management
Closed
austince
approved these changes
Feb 28, 2021
Contributor
austince
left a comment
There was a problem hiding this comment.
Looks really great Dave! Nice cleanups + catches in here.
| import java.util.List; | ||
| import java.util.stream.Collectors; | ||
|
|
||
| public class BulkAction { |
Contributor
There was a problem hiding this comment.
This is a really nice refactor/ consolidation.
Comment on lines
+756
to
+762
| if (!action.equals("action")) | ||
| throw new ValidationException("Each bulk operation must have only one action and payload."); | ||
| action = name; | ||
| params = Json.ORDERED_MAPPER.writeValueAsString(value); | ||
| break; | ||
| default: | ||
| throw new ValidationException("'" + name + "' is not a recognized action for bulk model management."); |
Contributor
There was a problem hiding this comment.
nit, might be nicer to send the error back to the listener here explicitly instead of throwing and then catching below
| Consumer<Exception> errorHandler = (e) -> ZentityPlugin.sendResponseError(channel, logger, e); | ||
|
|
||
| try { | ||
| boolean isBulkRequest = restRequest.path().endsWith("/_bulk"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces the Bulk Models API:
POST _zentity/models/_bulkThe API performs a serial execution of multiple model management operations (
"create","update","delete").Example:
The API optimizes efficiency by only ensuring the existence of the
.zentity-modelsindex once at the beginning of the bulk request, and only refreshing the index once at the end of the bulk request.The API syntax is almost identical to the Elasticsearch Bulk API, with the exception that
"delete"operations must be followed by an empty object ({}) instead of skipping the object altogether.Closes #57