Skip to content

Add "transformWith" to Task API which performs transformation by executing a task#295

Merged
junchuanwang merged 5 commits intomasterfrom
feature/transformWith
Feb 17, 2021
Merged

Add "transformWith" to Task API which performs transformation by executing a task#295
junchuanwang merged 5 commits intomasterfrom
feature/transformWith

Conversation

@junchuanwang
Copy link
Copy Markdown
Contributor

@junchuanwang junchuanwang commented Feb 16, 2021

Add "transformWith" to the Task API, that takes a function which returns a task, so that the transformation can be done by executing that task.

A main use case is for making the transformation a task so that can be executed asynchronously

@junchuanwang junchuanwang changed the title Add transformWith to Task API which performs transformation with a task Add "transformWith" to Task API which performs transformation by executing a task Feb 16, 2021
Comment thread subprojects/parseq/src/main/java/com/linkedin/parseq/Task.java
final SettablePromise<R> result = Promises.settable();
final Task<R> transform = async("transform", ctx -> {
final SettablePromise<R> transformResult = Promises.settable();
if (that.isFailed() && (Exceptions.isCancellation(that.getError()))) { //not treating cancellations as errors
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This comment is not very clear.
Please explain that when "that" task is cancelled, it doesn't propagate that to the function to get the task to execute.

@junchuanwang junchuanwang merged commit f012581 into master Feb 17, 2021
@junchuanwang junchuanwang deleted the feature/transformWith branch February 17, 2021 07:36
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