Skip to content

[NEW]mgmt resources, sync implementation for TaskGroup #45139

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

XiaofeiCao
Copy link
Contributor

@XiaofeiCao XiaofeiCao commented Apr 28, 2025

About this PR

This PR is a copy of previous PR with commits squashed.
Last one fails strangely for revapi check: #45068 (comment)
One of the commit added TaskGroup.failedFuture with public visibility, and the next one changed it to private. Shouldn't trigger any breaking changes to 2.50.0... Not sure how this bug happens..

Description

Part of sync-stack support for mgmt premium, and core-v2 if we want to keep premium packages.

Goal

  1. Provide sync interfaces for TaskGroup invocation without Reactor..
  2. Support specifying Executor to achieve task execution parallelism.

Context

A rough flow of TaskGroup.invokeAsync:
image

About this PR

TaskGroup.invoke's major change is in step4 -> Concurrently execute tasks.
Instead of Flux.merge, use CompletableFuture.allOf to join all CompletableFutures kicked off by CompletableFuture.supplyAsync with default or specified Executor.

Specify Executor by setting syncExecutor in InvocationContext, and execute via TaskGroup.invoke(InvocationContext).

To run task in the same thread as TaskGroup.invoke, set syncExecutor to Runnable::run.

Default Executor(if not specified) is ForkJoinPool.commonPool(), which is also the default Executor for CompletableFuture.

Test

Added tests in the same package as async ones, with Sync prefix.

Future works

  1. New sync APIs in resource base models, with Reactor as its default implementation.
  2. Override these new sync Resource API implementations for all packages.
  3. Remove Reactor default implementations for sync APIs.

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:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

@azure-sdk
Copy link
Collaborator

azure-sdk commented Apr 28, 2025

API Change Check

APIView identified API level changes in this PR and created the following API reviews

com.azure.resourcemanager:azure-resourcemanager-resources

@XiaofeiCao XiaofeiCao changed the title [DO NOT REVIEW] test revapi mgmt resources, sync implementation for TaskGroup Apr 29, 2025
@azure-sdk
Copy link
Collaborator

API change check

APIView has identified API level changes in this PR and created following API reviews.

com.azure.resourcemanager:azure-resourcemanager-resources

@XiaofeiCao XiaofeiCao changed the title mgmt resources, sync implementation for TaskGroup [DO NOT REVIEW]mgmt resources, sync implementation for TaskGroup Apr 29, 2025
@XiaofeiCao XiaofeiCao marked this pull request as ready for review April 29, 2025 04:09
@XiaofeiCao XiaofeiCao changed the title [DO NOT REVIEW]mgmt resources, sync implementation for TaskGroup mgmt resources, sync implementation for TaskGroup Apr 29, 2025
@XiaofeiCao
Copy link
Contributor Author

/azp run java - pullrequest

Copy link

Azure Pipelines failed to run 1 pipeline(s).

@XiaofeiCao XiaofeiCao changed the title mgmt resources, sync implementation for TaskGroup [NEW]mgmt resources, sync implementation for TaskGroup Apr 29, 2025
@XiaofeiCao
Copy link
Contributor Author

XiaofeiCao commented Apr 29, 2025

pullrequest CI is having issue triggering...
Possibly caused by: #45150 (comment)
Last one succeeded: https://dev.azure.com/azure-sdk/public/_build/results?buildId=4805872&view=results

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.

2 participants