-
Notifications
You must be signed in to change notification settings - Fork 440
TEZ-4008: Pluggable AM FrameworkServices and AmExtensions (2/3) #426
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
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
ff0acb6 to
fa6ec35
Compare
This comment was marked as outdated.
This comment was marked as outdated.
23ce3eb to
f0a349c
Compare
This comment was marked as outdated.
This comment was marked as outdated.
325bcf4 to
e08ff20
Compare
This comment was marked as outdated.
This comment was marked as outdated.
e08ff20 to
8febe5b
Compare
This comment was marked as outdated.
This comment was marked as outdated.
8febe5b to
5a2a6d3
Compare
This comment was marked as outdated.
This comment was marked as outdated.
5a2a6d3 to
6ff2aa5
Compare
|
🎊 +1 overall
This message was automatically generated. |
ayushtkn
left a comment
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.
Thanx @abstractdog, minor comments, rest LGTM
tez-api/pom.xml
Outdated
| </dependency> | ||
| <dependency> | ||
| <groupId>org.apache.hadoop</groupId> | ||
| <artifactId>hadoop-yarn-registry</artifactId> |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these two aren't used anywhere
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we bail out early if other == 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.
yeah, that branch is part of traditional equals method, let me add
| } | ||
| } | ||
|
|
||
| public ServiceRecord toServiceRecord() { |
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.
this isn't used either?
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.
same as above, adding javadoc
| @Override | ||
| public int hashCode() { | ||
| return appId.hashCode() * host.hashCode() * id.hashCode() + port; |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch, adding it
86e29f2 to
a0159bd
Compare
This comment was marked as outdated.
This comment was marked as outdated.
|
thanks for the review so far, @ayushtkn, addressed them, precommit is green |
a0159bd to
b05793a
Compare
|
🎊 +1 overall
This message was automatically generated. |
ayushtkn
left a comment
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.
LGTM
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.