-
Notifications
You must be signed in to change notification settings - Fork 2.1k
mgmt resources, sync implementation for TaskGroup #45068
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
base: main
Are you sure you want to change the base?
Conversation
API Change CheckAPIView identified API level changes in this PR and created the following API reviews |
API change check APIView has identified API level changes in this PR and created following API reviews. |
*/ | ||
final class ErroredDependencyTaskException extends Exception { | ||
final class ErroredDependencyTaskException extends RuntimeException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not expected for user to catch this Exception. It'll be caught only in TaskGroup
implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe a slightly easy-to-read name, errored
feels strange? FailedDependencyTaskException
?
Not sure why pipeline revapi keeps complaining about breaking change of This method wasn't even added in 2.50.0. My local build and check doesn't have this issue... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did a quick read and didn't see problem.
However, merging of the PR would mean that it be under revapi check.
PS: also not sure why failedFuture
errors (and the old Analysis CI passes).
*/ | ||
final class ErroredDependencyTaskException extends Exception { | ||
final class ErroredDependencyTaskException extends RuntimeException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe a slightly easy-to-read name, errored
feels strange? FailedDependencyTaskException
?
...er-resources/src/main/java/com/azure/resourcemanager/resources/fluentcore/dag/TaskGroup.java
Outdated
Show resolved
Hide resolved
public InvocationContext withSyncTaskExecutor(Executor syncExecutor) { | ||
Objects.requireNonNull(syncExecutor); | ||
this.syncExecutor = syncExecutor; | ||
return this; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this supposed to be called by our lib in its API (when create the TaskGroup), or by user? Likely won't be user?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'll be called by our libs. E.g. CreatableUpdatableImpl
.
I planned to also put this configuration in ResourceManagerUtils
, where user can set ReactorScheduler
in InternalContext. E.g. setSyncTaskExecutor
.
Surely we can use ResourceManagerUtils
directly in TaskGroup
, though I thought a separation of layers could be useful(TaskGroup vs CreatableUpdatableImpl).
Created a new PR with commits squashed. Seems revapi issue has gone for that one... |
close by #45139 |
Seems the revapi issue in pullrequest CI has been fixed. Will still use this PR. |
Description
Part of sync-stack support for mgmt premium, and core-v2 if we want to keep premium packages.
Goal
TaskGroup
invocation without Reactor..Executor
to achieve task execution parallelism.Context
A rough flow of

TaskGroup.invokeAsync
:About this PR
TaskGroup.invoke
's major change is in step4 -> Concurrently execute tasks.Instead of
Flux.merge
, useCompletableFuture.allOf
to join allCompletableFuture
s kicked off byCompletableFuture.supplyAsync
with default or specifiedExecutor
.Specify
Executor
by settingsyncExecutor
inInvocationContext
, and execute viaTaskGroup.invoke(InvocationContext)
.To run task in the same thread as
TaskGroup.invoke
, setsyncExecutor
toRunnable::run
.Default
Executor
(if not specified) isForkJoinPool.commonPool()
, which is also the default Executor forCompletableFuture
.Test
Added tests in the same package as async ones, with
Sync
prefix.Future works
Please add an informative description that covers that changes made by the pull request and link all relevant issues.
If an SDK is being regenerated based on a new swagger spec, a link to the pull request containing these swagger spec changes has been included above.
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines