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-16871][runtime] Make more build time information available at runtime #11592
Conversation
Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community Automated ChecksLast check on commit 5e4d9cc (Wed Apr 01 08:35:50 UTC 2020) 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:
|
5e4d9cc
to
d215e4d
Compare
On my machine the |
@azagrebin / @wangyang0918 Would you be so kind to have a look at this. |
Thanks for splitting this @nielsbasjes As I understand, the current PR still requires running code generation otherwise the runtime module is broken. I agree that e.g. IntelliJ Idea has a button in maven panel to generate sources which takes some time, at least initially. Nonetheless, this will take time for people to adopt to this. As mentioned in the original discussion, we could try approach where we have a @zentol might also have further opinion about 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.
I agree that we should not be required to first generate some code before we can do anything in the IDE. This will be super annoying when switching branches.
flink-runtime/src/main/java/org/apache/flink/runtime/util/EnvironmentInformation.java
Outdated
Show resolved
Hide resolved
flink-runtime/src/main/java/org/apache/flink/runtime/util/EnvironmentInformation.java
Outdated
Show resolved
Hide resolved
@azagrebin @zentol About generating the Version.java and switching branches. So in general the problems you are addressing already exist in a large scale in the project. You cannot simply switch branch and then successfully run the project without doing a Putting a question back: What implementation approach do you recommend? |
d215e4d
to
47099f6
Compare
This isn't quite accurate. By virtue of us rarely adding code generation and generally not changing it, it over time becomes feasible to switch between the currently supported version branches.
So, I only briefly looked into it. My original idea was to have a normal One approach we could take though is similar to the old one we had.
Then just parse it back. This could even be a JSON file that we throw jackson at. However, I do realize that I may be too strict in regards to code-generation, so I would encourage you to raise the issue on the mailing list in search for supporters. |
I went back to the generating a .version.properties file which is then loaded as a resource using classloader (which I consider to be brittle and unreliable!). This way you can say 'if no file then use default' as requested. The big downside of this is that someone can (accidentally) change the code by overriding this resource by putting a different one in the classpath (which happens) and IntelliJ still messes things up occasionally. So the runtime code has to catch these problems. Also in the original code
NOTE: If you run this now from within IntelliJ it still does not generate the files correctly (i.e. IntelliJ does not follow the instructions defined in the pom.xml) which sometimes creates a version file like this (which is handled by the runtime code):
Side note: Looking a the |
@zentol The patch I submitted just now does what was originally the case (i.e. the generated properties file) which has been extended with a few additional attributes. Essentially the solution you suggested just now Although I really think the generated Version.java (as I submitted before) is the best way to do this, I fine with either solution. Can you please review what is there now (and my previous post, which we both posted at almost exactly the same moment) so this foundation for https://issues.apache.org/jira/browse/FLINK-15794 can be used to begin that change. Thanks. |
@zentol As suggested I have posted the question to the dev mailing list: http://mail-archives.apache.org/mod_mbox/flink-dev/202004.mbox/%3CCADoiZqq_VQEn57K3RwNv%3DDXgDWFf%3D5d6b9rX2odJh_PRmj7PsA%40mail.gmail.com%3E |
47099f6
to
347da3e
Compare
@zentol I have been thinking about everything that was said and I think I found a way that is in line with what was said in the mailing list. In line with the remark by @tillrohrmann if the file is missing or badly generated the system will throw a So the file is either valid or will lead to an exception. Please indicate if this is an acceptable solution. |
85b8520
to
3f68dbf
Compare
flink-runtime/src/main/java/org/apache/flink/runtime/util/EnvironmentInformation.java
Show resolved
Hide resolved
flink-runtime/src/main/java/org/apache/flink/runtime/util/EnvironmentInformation.java
Outdated
Show resolved
Hide resolved
flink-runtime/src/main/java/org/apache/flink/runtime/util/EnvironmentInformation.java
Outdated
Show resolved
Hide resolved
flink-runtime/src/main/java/org/apache/flink/runtime/util/EnvironmentInformation.java
Outdated
Show resolved
Hide resolved
flink-runtime/src/main/java/org/apache/flink/runtime/util/EnvironmentInformation.java
Outdated
Show resolved
Hide resolved
flink-runtime/src/main/java/org/apache/flink/runtime/util/EnvironmentInformation.java
Outdated
Show resolved
Hide resolved
flink-runtime/src/main/java/org/apache/flink/runtime/util/EnvironmentInformation.java
Outdated
Show resolved
Hide resolved
9827205
to
089bf5d
Compare
So what it does now:
|
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.
Found some minor things, but I overall it is good.
flink-runtime/src/main/java/org/apache/flink/runtime/util/EnvironmentInformation.java
Outdated
Show resolved
Hide resolved
flink-runtime/src/main/java/org/apache/flink/runtime/util/EnvironmentInformation.java
Outdated
Show resolved
Hide resolved
flink-runtime/src/main/java/org/apache/flink/runtime/util/EnvironmentInformation.java
Show resolved
Hide resolved
168bea6
to
1569b0f
Compare
I did a rebase + squash to the latest master branch. |
1569b0f
to
6bfea91
Compare
6bfea91
to
ec92e1b
Compare
FLINK-16871: Make more build time information available at runtime
What is the purpose of the change
As discussed here additional build time information is needed at runtime. This pull request is to make this specific change a separate thing.
Brief change log
Instant
. This makes it possible to reliably format these timestamps in any form we like. The code has been structured in such a way that as little as possible memory remains allocated. For the latest commit and build time a String version of those timestamps is also available and those are formatted using the Europe/Berlin timezone (the origin of Flink) and thus independent of the locale/timezone of the system that created the build.Verifying this change
This change added a few basic test steps.
Verifying the actual values is not possible because after commit and on each build the values will (and should) be different. Also checking if the commit time is not older than X would mean that a working version of the software would fail the build a while later.
Does this pull request potentially affect one of the following parts:
@Public(Evolving)
: noDocumentation