Skip to content

TINKERPOP-2806 Provide method for provider plugins to get notified on script/query processing#1837

Closed
tkolanko wants to merge 4 commits intoapache:3.6-devfrom
tkolanko:3.6-dev
Closed

TINKERPOP-2806 Provide method for provider plugins to get notified on script/query processing#1837
tkolanko wants to merge 4 commits intoapache:3.6-devfrom
tkolanko:3.6-dev

Conversation

@tkolanko
Copy link
Contributor

This PR adds 3 new default methods to the GraphManager interface allowing custom GraphManagers to opt into receiving notifications based on the lifecycle of scripts/traversals.

AbstractEvalOpProcessor and TraversalOpProcessor get the GraphManager from context and call the lifecycle methods as needed.

docker/build.sh -t -i -n passes all tests

I created a proposal thread on https://lists.apache.org/thread/b3k8b4j29gswyk39pl4cfsvd5ofozh4l but there wasn't much interaction, I'm hoping we can get some more discussion from a PR

… script/query processing

This PR adds 3 new default methods to the GraphManager interface allowing custom GraphManagers to opt into receiving notifications based on the lifecycle of scripts/traversals.

AbstractEvalOpProcessor and TraversalOpProcessor get the GraphManager from context and call the lifecycle methods as needed.

docker/build.sh -t -i -n passes all tests
graphManager.onQueryError(msg, t);
if (managedTransactionsForRequest) attemptRollback(msg, ctx.getGraphManager(), settings.strictTransactionManagement);
})
.afterTimeout(b -> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is unfortunate. i assume there is no way to get the original time-out exception thrown? do we really have to construct a fresh exception here just for purpose of getting one to onQueryError()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In 3e5a38c I refactored all instances of afterTimeout to switch from a Consumer to a BiConsumer so that it can be called with the original exception. It was a smallish change, however, I'm not sure the best way to update the docs to indiciate the signature change and given that this is now a breaking change I think it should be targetted for the next major. I'm not sure how prevalent lifecycle usages are in the wild

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for the delay in reviewing your latest changes. unfortunately, i think the breaking change forces this into 3.7.x rather than 3.6.x. there are several providers who rely on this API. Maybe you could turn it back into a non-breaking change though? Since it is just a callback, you could add the new signature for afterTimeout() as an overload. You could then have GremlinExecutor call both. Deprecate the Consumer version and ensure the javadoc makes clear that users should only utilize one of those two methods as a single timeout triggers them both. Would that work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spmallette In 718c083 I deprecated the use of afterTimeout as a consumer and I had the deprecated method create a new BiConsumer which calls the updated afterTimeout method. I also reverted the GremlinExecutor tests to use the deprecated method to make sure they are still working, I can either move them to the new method or leave things as they are

tkolanko and others added 2 commits October 24, 2022 06:34
afterTimeout has changed from a Consumer to a BiConsumer allowing it
to accept a throwable when called.
@codecov-commenter
Copy link

codecov-commenter commented Nov 4, 2022

Codecov Report

Merging #1837 (718c083) into 3.6-dev (f88755a) will decrease coverage by 0.22%.
The diff coverage is 75.00%.

@@              Coverage Diff              @@
##             3.6-dev    #1837      +/-   ##
=============================================
- Coverage      69.66%   69.43%   -0.23%     
- Complexity      9308     9346      +38     
=============================================
  Files            852      875      +23     
  Lines          38058    41764    +3706     
  Branches        5620     5624       +4     
=============================================
+ Hits           26512    28998    +2486     
- Misses          9737    10780    +1043     
- Partials        1809     1986     +177     
Impacted Files Coverage Δ
...nkerpop/gremlin/groovy/engine/GremlinExecutor.java 87.24% <70.00%> (-0.47%) ⬇️
...pop/gremlin/server/op/AbstractEvalOpProcessor.java 48.05% <71.42%> (+3.15%) ⬆️
...mlin/server/op/traversal/TraversalOpProcessor.java 47.46% <71.42%> (+1.08%) ⬆️
.../apache/tinkerpop/gremlin/server/GraphManager.java 83.33% <100.00%> (+16.66%) ⬆️
...e/tinkerpop/gremlin/server/op/session/Session.java 64.51% <100.00%> (+64.51%) ⬆️
...pop/gremlin/server/util/ServerGremlinExecutor.java 81.25% <100.00%> (ø)
.../step/map/ConnectedComponentVertexProgramStep.java 70.58% <0.00%> (-5.89%) ⬇️
...a/org/apache/tinkerpop/gremlin/server/Context.java 84.05% <0.00%> (-1.45%) ⬇️
...kergraph/process/computer/TinkerGraphComputer.java 95.41% <0.00%> (-0.77%) ⬇️
... and 34 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@spmallette
Copy link
Contributor

Cherry-picked as:

24e74da
ca91069
f13ce6e

and then added an extra commit with some little fixes/docs: cf211fd

sorry this took a while to get merged. thanks for your contribution.

@spmallette spmallette closed this Nov 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants