Skip to content
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

feat: terminate data flow on transfer completion #3481

Merged

Conversation

ndr-brt
Copy link
Member

@ndr-brt ndr-brt commented Sep 28, 2023

What this PR changes/adds

Ensures that the data flow gets terminated when the PolicyMonitor detects a no more valid policy.

Why it does that

policy monitor

Further notes

  • now a DataFlowController can be terminated through the terminate method
  • in the data plane, a flow termination can be done by calling close on the DataSource

Linked Issue(s)

Closes #3453

Please be sure to take a look at the contributing guidelines and our etiquette for pull requests.

@ndr-brt ndr-brt added enhancement New feature or request core feature labels Sep 28, 2023
@codecov-commenter
Copy link

codecov-commenter commented Sep 28, 2023

Codecov Report

Attention: 21 lines in your changes are missing coverage. Please review.

Comparison is base (f7c0751) 72.08% compared to head (960e5a2) 72.13%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3481      +/-   ##
==========================================
+ Coverage   72.08%   72.13%   +0.05%     
==========================================
  Files         841      839       -2     
  Lines       16996    17036      +40     
  Branches      951      955       +4     
==========================================
+ Hits        12251    12289      +38     
- Misses       4341     4345       +4     
+ Partials      404      402       -2     
Files Coverage Δ
.../statemachine/retry/EntityRetryProcessFactory.java 0.00% <ø> (ø)
...c/connector/transfer/flow/DataFlowManagerImpl.java 100.00% <100.00%> (ø)
...r/transfer/process/TransferProcessManagerImpl.java 94.77% <100.00%> (+0.11%) ⬆️
...taplane/framework/DataPlaneFrameworkExtension.java 84.61% <100.00%> (-0.39%) ⬇️
...aplane/framework/manager/DataPlaneManagerImpl.java 87.91% <100.00%> (+2.01%) ⬆️
...licy/monitor/manager/PolicyMonitorManagerImpl.java 100.00% <100.00%> (ø)
...erprocess/TransferProcessControlApiController.java 71.42% <ø> (ø)
...e/flow/ConsumerPullTransferDataFlowController.java 100.00% <100.00%> (ø)
...e/flow/ProviderPushTransferDataFlowController.java 93.33% <100.00%> (+0.47%) ⬆️
...er/JsonObjectFromDataPlaneInstanceTransformer.java 94.73% <100.00%> (ø)
... and 12 more

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ndr-brt ndr-brt changed the title feat: policy-monitor: terminate data flow on transfer completion. feat: terminate data flow on transfer completion. Sep 28, 2023
@ndr-brt ndr-brt force-pushed the 3453-stop-dataflow-on-completion branch from 91a6425 to 94909ca Compare September 28, 2023 15:03
@ndr-brt ndr-brt changed the title feat: terminate data flow on transfer completion. feat: terminate data flow on transfer completion Sep 28, 2023
@ndr-brt ndr-brt marked this pull request as ready for review September 28, 2023 15:05
@ndr-brt ndr-brt force-pushed the 3453-stop-dataflow-on-completion branch 2 times, most recently from 5ebe8cd to 1f25856 Compare September 28, 2023 15:21
@jimmarino
Copy link
Contributor

@ndr-brt It would be good to first add a DR outlining this new state and its uses.

Copy link
Member

@paullatzelsperger paullatzelsperger left a comment

Choose a reason for hiding this comment

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

I had a few questions regarding "terminating" vs "stopping".

  • when we terminate, we send a TransferTerminationMessage, but when we stop, we don't send anything. Is that on purpose? Shouldn't we notify the counter-party, that a transfer has been stopped?
  • conversely, when we "terminate", we don't invoke the dataflow manager, so theoretically there could still be an ongoing transfer, right?
  • isn't "stopping" almost the same as "terminating", but with a "configurable" next state? Or rather: isn't terminating just stopping with a preconfigured next state?

If those questions are scoped too broadly, we can just merge the PR and discuss elsewhere

public void transitionStopping(String reason, TransferProcessStates subsequentState) {
transition(STOPPING, STARTED);
errorDetail = reason;
privateProperties.put("stopping-subsequent-state", subsequentState);
Copy link
Member

Choose a reason for hiding this comment

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

nit: use a constant

@@ -91,6 +92,11 @@ public ServiceResult<Stream<TransferProcess>> query(QuerySpec query) {
});
}

@Override
public ServiceResult<Void> stop(StopTransferCommand command) {
Copy link
Member

Choose a reason for hiding this comment

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

to keep consistency with the other methods, this should probably also be @NotNull

@ndr-brt
Copy link
Member Author

ndr-brt commented Sep 29, 2023

@paullatzelsperger , yes, sorry, I discussed with @jimmarino after then and decided to avoid that STOPPING status, instead the data flow termination will be invoked before the transfer process termination. I updated the PR accordingly, now it's ready to be reviewed.

@ndr-brt ndr-brt force-pushed the 3453-stop-dataflow-on-completion branch from 6267be7 to 7544346 Compare September 29, 2023 10:01
@ndr-brt ndr-brt force-pushed the 3453-stop-dataflow-on-completion branch 2 times, most recently from 37919df to f8a509f Compare September 29, 2023 11:40
Copy link
Contributor

@bscholtes1A bscholtes1A left a comment

Choose a reason for hiding this comment

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

Great stuff!

@ndr-brt ndr-brt merged commit 915da25 into eclipse-edc:main Oct 4, 2023
20 checks passed
@ndr-brt ndr-brt deleted the 3453-stop-dataflow-on-completion branch October 4, 2023 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core feature enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

policy-monitor: data flow should be stopped on transfer completion
6 participants