-
Notifications
You must be signed in to change notification settings - Fork 13k
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
[FLINK-14839][config] Let JobGraph#classpaths become non-null #10235
Conversation
* | ||
* @return True, if the JobGraph has user code JAR files attached, false otherwise. | ||
*/ | ||
public boolean hasUsercodeJarFiles() { |
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.
unused
Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community Automated ChecksLast check on commit 71f07dc (Wed Dec 04 15:55:27 UTC 2019) Warnings:
Mention the bot in a comment to re-run the automated checks. Review Progress
Please see the Pull Request Review Guide for a full explanation of the review process. The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required Bot commandsThe @flinkbot bot supports the following commands:
|
@flinkbot run travis |
e1f7257
to
30ef6bc
Compare
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.
Looks ok. I have left some remarks.
flink-runtime/src/main/java/org/apache/flink/runtime/jobgraph/JobGraph.java
Show resolved
Hide resolved
@@ -352,8 +353,8 @@ public JobVertex findVertexByID(JobVertexID id) { | |||
* | |||
* @param paths paths of the directories/JAR files required to run the job on a task manager | |||
*/ | |||
public void setClasspaths(List<URL> paths) { | |||
classpaths = paths; | |||
public void addClasspaths(Collection<URL> paths) { |
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.
Are we actually invoking addClasspaths
multiple times? It seems that the changeset could be smaller by just adding a null check to the setter.
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.
So for addJars
. We don't call addJars
multiple times for now. However, it fits the abstraction that we firstly instance an empty collection and then add member per call. If we still using setter and with a null checker the field cannot be final
while we don't gain a lot from such mutability.
30ef6bc
to
7c0af1f
Compare
…ives nullable parameter
@GJL could you give this patch another pass? I've addressed your comments above. |
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 am afraid that we cannot do this change. Let me know if you see a workaround.
@@ -100,7 +101,7 @@ | |||
private final List<PermanentBlobKey> userJarBlobKeys = new ArrayList<>(); | |||
|
|||
/** List of classpaths required to run this job. */ | |||
private List<URL> classpaths = Collections.emptyList(); |
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 problematic that JobGraph
implements Serialized
and classpaths
is a non-transient field. After a cluster upgrade to 1.10 addClasspaths
will throw UnsupportedOperationException
if classpath
of the serialized JobGraph was previously empty.
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.
OK I can see the problem. Although we can work around by adding another field and add some bridge code I don't it is worth to do so because this is just a nice to have improvement. A reasonable way in my mind is that we take this thing into consideration when we port JobGraph to its protobuf version if there will be one. Anyway, defer the effort until we are in a codebase easy to do it.
closed as I cannot find a worthy workaround for the problem described in https://github.com/apache/flink/pull/10235/files/71f07dc72c9590bef027993dc258e598137514a7#r351205882 |
What is the purpose of the change
JobGraph#userJars & JobGraph#classpaths are non-null, so we can improve our codes a bit.
Brief change log
ArrayList
instead of changing the reference.setClasspaths
toaddClasspaths
Verifying this change
This change is a trivial rework / code cleanup without any test coverage.
Does this pull request potentially affect one of the following parts:
@Public(Evolving)
: (no)Documentation
cc @zentol @GJL