Uh oh!
There was an error while loading. Please reload this page.
TEZ-4008: Pluggable AM FrameworkServices and AmExtensions (2/3) - #426
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
23ce3eb to
f0a349cCompare
This comment was marked as outdated.
This comment was marked as outdated.
325bcf4 to
e08ff20Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
tez-yetus
commented
Sep 3, 2025
🎊 +1 overall
This message was automatically generated. |
ayushtkn
left a comment
There was a problem hiding this comment.
Thanx @abstractdog, minor comments, rest LGTM
| </dependency> | ||
| <dependency> | ||
| <groupId>org.apache.hadoop</groupId> | ||
| <artifactId>hadoop-yarn-registry</artifactId> |
There was a problem hiding this comment.
use hadoop-registry, hadoop-yarn-registry is just a stub pom, which has only hadoop-registry
https://issues.apache.org/jira/browse/HADOOP-15821
| public AMRecord(AMRecord other) { | ||
| this.appId = other.getApplicationId(); | ||
| this.host = other.getHost(); | ||
| this.port = other.getPort(); | ||
| this.id = other.getId(); | ||
| } | ||
| public AMRecord(ServiceRecord serviceRecord) { | ||
| this.appId = ApplicationId.fromString(serviceRecord.get(APP_ID_RECORD_KEY)); | ||
| this.host = serviceRecord.get(HOST_RECORD_KEY); | ||
| this.port = Integer.parseInt(serviceRecord.get(PORT_RECORD_KEY)); | ||
| this.id = serviceRecord.get(OPAQUE_ID_KEY); | ||
| } |
There was a problem hiding this comment.
they aren't used from tez code base, instead at tez clients that might want to handle tez unmanaged sessions
I know this looks strange at first sight, but let me add javadoc clarifying this, and you'll see if it's more straightforward
| @Override | ||
| public boolean equals(Object other) { | ||
| if (other instanceof AMRecord otherRecord) { |
There was a problem hiding this comment.
should we bail out early if other == this?
There was a problem hiding this comment.
yeah, that branch is part of traditional equals method, let me add
| } | ||
| } | ||
| public ServiceRecord toServiceRecord() { |
There was a problem hiding this comment.
same as above, adding javadoc
| @Override | ||
| public int hashCode() { | ||
| return appId.hashCode() * host.hashCode() * id.hashCode() + port; |
There was a problem hiding this comment.
multiplying can easily lead to overflow & two values can collide easily. If any of appId, host or id is null, this will lead to NPE as well.
How about using
return Objects.hash(appId, host, port, id);
There was a problem hiding this comment.
nice, I haven't used this before :D let me fix
| public static final String TEZ_CLIENT_VERSION_ENV = "TEZ_CLIENT_VERSION"; | ||
| //Arbitrary opaque ID to identify AM instances from AMRegistryClient | ||
| public static final String TEZ_AM_UUID = "UUID"; |
There was a problem hiding this comment.
is there a possibility to use TEZ_AM_UUID rather than just UUID?
| Configuration conf = new Configuration(); | ||
| AMRegistry amRegistry = AMRegistryUtils.createAMRegistry(conf); | ||
| assertNull(amRegistry); | ||
| String className = "org.apache.tez.dag.api.client.registry.TestAMRegistry$SkeletonAMRegistry"; |
There was a problem hiding this comment.
can we do String className = SkeletonAMRegistry.class.getName(); rather than hardcoding
| amRegistry = AMRegistryUtils.createAMRegistry(conf); | ||
| assertEquals(className, amRegistry.getClass().getName()); |
There was a problem hiding this comment.
should add
assertNotNull(amRegistry);
Else if it still stays null, rather than failing with some nice error, it will fail with NPE
There was a problem hiding this comment.
good catch, adding it
This comment was marked as outdated.
This comment was marked as outdated.
abstractdog
commented
Sep 4, 2025
thanks for the review so far, @ayushtkn, addressed them, precommit is green |
tez-yetus
commented
Sep 4, 2025
🎊 +1 overall
This message was automatically generated. |
Uh oh!
There was an error while loading. Please reload this page.
As described on jira:
Interface and reflective plugin configuration for a pool of AMs identified by a namespace.
The registry should allow each DAGClientServer to register/unregister themselves from a pool.
Basically, this PR introduces AMRegistry that is going to be implemented in TEZ-4007 by a Zookeeper AM registry.