-
Notifications
You must be signed in to change notification settings - Fork 94
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
IGNITE-22435 Add JobTarget interface #3950
Conversation
modules/client/src/main/java/org/apache/ignite/internal/client/compute/ClientCompute.java
Outdated
Show resolved
Hide resolved
modules/client/src/main/java/org/apache/ignite/internal/client/compute/ClientCompute.java
Show resolved
Hide resolved
modules/client/src/test/java/org/apache/ignite/client/fakes/FakeCompute.java
Outdated
Show resolved
Hide resolved
...s/compute/src/integrationTest/java/org/apache/ignite/internal/compute/ItComputeBaseTest.java
Outdated
Show resolved
Hide resolved
modules/compute/src/main/java/org/apache/ignite/internal/compute/IgniteComputeImpl.java
Outdated
Show resolved
Hide resolved
/** | ||
* Creates a job target for any node from the provided collection. | ||
* | ||
* @param nodes Collection of nodes. | ||
* @return Job target. | ||
*/ | ||
static JobTarget anyNode(ClusterNode... nodes) { | ||
return new NodesJobTarget(Set.of(nodes)); | ||
} | ||
|
||
/** | ||
* Creates a job target for any node from the provided collection. | ||
* | ||
* @param nodes Collection of nodes. | ||
* @return Job target. | ||
*/ | ||
static JobTarget anyNode(Collection<ClusterNode> nodes) { | ||
return new NodesJobTarget(new HashSet<>(nodes)); | ||
} |
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.
Should we mention that the collection of nodes is treated as a Set (duplicates are ignored)?
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 don't think this matters with "any node" semantics because we don't explain how a node is picked from the provided collection. There is no guarantee of fairness or randomness on the API level.
…/compute/ClientCompute.java Co-authored-by: Vadim Pakhnushev <8614891+valepakh@users.noreply.github.com>
…keCompute.java Co-authored-by: Vadim Pakhnushev <8614891+valepakh@users.noreply.github.com>
…ernal/compute/ItComputeBaseTest.java Co-authored-by: Vadim Pakhnushev <8614891+valepakh@users.noreply.github.com>
…te/IgniteComputeImpl.java Co-authored-by: Vadim Pakhnushev <8614891+valepakh@users.noreply.github.com>
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.
the changes in API module looks good in general. I left a few suggestions on how to improve javadoc though
modules/api/src/main/java/org/apache/ignite/compute/NodesJobTarget.java
Outdated
Show resolved
Hide resolved
modules/api/src/main/java/org/apache/ignite/compute/JobTarget.java
Outdated
Show resolved
Hide resolved
modules/api/src/main/java/org/apache/ignite/compute/JobTarget.java
Outdated
Show resolved
Hide resolved
modules/api/src/main/java/org/apache/ignite/compute/JobTarget.java
Outdated
Show resolved
Hide resolved
modules/api/src/main/java/org/apache/ignite/compute/JobTarget.java
Outdated
Show resolved
Hide resolved
modules/api/src/main/java/org/apache/ignite/compute/JobTarget.java
Outdated
Show resolved
Hide resolved
modules/api/src/main/java/org/apache/ignite/compute/JobTarget.java
Outdated
Show resolved
Hide resolved
modules/client/src/main/java/org/apache/ignite/internal/client/compute/ClientCompute.java
Outdated
Show resolved
Hide resolved
…java Co-authored-by: korlov42 <korlov@gridgain.com>
…java Co-authored-by: korlov42 <korlov@gridgain.com>
…java Co-authored-by: korlov42 <korlov@gridgain.com>
…java Co-authored-by: korlov42 <korlov@gridgain.com>
…java Co-authored-by: korlov42 <korlov@gridgain.com>
…java Co-authored-by: korlov42 <korlov@gridgain.com>
…java Co-authored-by: korlov42 <korlov@gridgain.com>
…/compute/ClientCompute.java Co-authored-by: Vadim Pakhnushev <8614891+valepakh@users.noreply.github.com>
Reduce the number of overloads in
IgniteCompute
and make the API more readable with newJobTarget
interface:Usage Example