GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — 2.x: add resilient versions of parallel map(), filter() & doOnNext() by akarnokd · Pull Request #5202 · ReactiveX/RxJava

Conversation

@akarnokd

@akarnokd akarnokd commented Mar 20, 2017

Copy link
Copy Markdown
Member

This PR adds 2 new overloads to ParallelFlowable operators map, filter and doOnNext to enable per item error handling in case the main function fails with some exception.

Flowable.range(0, 2)
.parallel(1)
.map(v -> 1 / v, ParallelFailureHandling.SKIP)
.sequential()
.test()
.assertResult(1);

The new ParallelFailureHandling has some default enumeration values to handle the common cases. In addition, the BiFunction overload allows bounded retries and/or conditional handling of failures.

Related: #5128.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@akarnokd akarnokd added 2.x Enhancement labels Mar 20, 2017
@akarnokd akarnokd added this to the 2.1 milestone Mar 20, 2017
@akarnokd
2.x: add resilient versions of parallel map(), filter() & doOnNext()
dc08894
@akarnokd
akarnokd force-pushed the ParallelOpResilience branch from 3ec4fd3 to dc08894 Compare March 20, 2017 14:46
@codecov

codecov Bot commented Mar 20, 2017

Copy link
Copy Markdown

Codecov Report

Merging #5202 into 2.x will increase coverage by 0.15%.
The diff coverage is 98.42%.

@@             Coverage Diff             @@
##                2.x   #5202      +/-   ##
===========================================
+ Coverage     95.94%   96.1%   +0.15%     
- Complexity     5677    5709      +32     
===========================================
  Files           621     625       +4     
  Lines         40611   40991     +380     
  Branches       5632    5675      +43     
===========================================
+ Hits          38963   39393     +430     
+ Misses          666     627      -39     
+ Partials        982     971      -11
Impacted Files Coverage Δ Complexity Δ
...ex/internal/operators/parallel/ParallelFilter.java 97.59% <100%> (ø) 6 <0> (ø) ⬇️
...n/java/io/reactivex/parallel/ParallelFlowable.java 100% <100%> (ø) 49 <6> (+6) ⬆️
...io/reactivex/parallel/ParallelFailureHandling.java 100% <100%> (ø) 3 <3> (?)
...internal/operators/parallel/ParallelFilterTry.java 98.26% <98.26%> (ø) 6 <6> (?)
...ternal/operators/parallel/ParallelDoOnNextTry.java 98.33% <98.33%> (ø) 6 <6> (?)
...ex/internal/operators/parallel/ParallelMapTry.java 98.33% <98.33%> (ø) 6 <6> (?)
...erators/completable/CompletableConcatIterable.java 95.91% <0%> (-4.09%) 2% <0%> (ø)
...reactivex/internal/operators/single/SingleAmb.java 96.36% <0%> (-3.64%) 9% <0%> (-1%)
...perators/flowable/FlowableSequenceEqualSingle.java 96.61% <0%> (-3.39%) 3% <0%> (ø)
...ternal/operators/flowable/FlowableSubscribeOn.java 94.91% <0%> (-3.39%) 2% <0%> (ø)
... and 46 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 21a7a05...dc08894. Read the comment docs.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@akarnokd
akarnokd merged commit 1b60b12 into ReactiveX:2.x Mar 23, 2017
@akarnokd
akarnokd deleted the ParallelOpResilience branch March 23, 2017 17:28
This was referenced Mar 24, 2017
2.0.8 release preparations #5220
Closed
2.x: resilience in the parallel() operators #5128
Closed
ParallelFlowable, sequential and exception management #5108
Closed
@michaelEllisUy michaelEllisUy mentioned this pull request Jun 1, 2017
Dependency update: rxjava xmartlabs/bigbang#82
Closed
@AarjavP

AarjavP commented Jun 6, 2018

Copy link
Copy Markdown

Sorry if this is not the correct place for this question, however it's relevant to the above feature.
I would like to have an error handler/on error callback but continue the processing, or specify the number of retries.
Can the ParallelFailureHandling enum be made into an interface instead? I see the enum instances are all used in the same way in all the tryOnNext methods of the 3 operators (filter, map, and doOnNext). The existing enums can maybe 'built-in' handler instances. Something like:

built-ins:

.map(v -> 1 / v, ParallelFailureHandling.SKIP) //static instance

some customizable built-ins:

.map(v -> 1 / v, ParallelFailureHandling.retry(5)) //retry 5 times before failing

user defined:

.map(v -> 1 / v, (retries, err) -> { log.error(err); return ParrallelFailureHandling.Result.SKIP; })

The return values could be SKIP/IGNORE, RETRY, STOP, default(val), or error(ex)

Or perhaps this is already do able using existing api?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@akarnokd

akarnokd commented Jun 6, 2018

Copy link
Copy Markdown
Member Author

Please always check the available operators first before asking for a feature: http://reactivex.io/RxJava/2.x/javadoc/io/reactivex/parallel/ParallelFlowable.html#map-io.reactivex.functions.Function-io.reactivex.functions.BiFunction-

The enums are just convenience implementations of the BiFunction variants of the operators.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

2.x Enhancement

Projects

None yet

Milestone

2.1

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@akarnokd @AarjavP
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.