-
Notifications
You must be signed in to change notification settings - Fork 32
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
Java edits for kb-sdk 1.3 #350
Java edits for kb-sdk 1.3 #350
Conversation
@@ -102,7 +102,7 @@ | |||
</target> | |||
|
|||
|
|||
|
|||
<tstamp/> |
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.
Timestamp
@@ -116,7 +116,8 @@ | |||
<echo file="${src}/us/kbase/mobu/git.properties">### PLEASE DO NOT CHANGE THIS FILE MANUALLY! ### | |||
giturl=${git.url} | |||
branch=${git.branch} | |||
commit=${git.commit}</echo> | |||
commit=${git.commit} | |||
build_timestamp=${DSTAMP}-${TSTAMP}</echo> |
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.
add date and time to the git.properties
file
+ (gitCommit == null ? "" : (" (commit " + gitCommit + ")"))); | ||
} | ||
|
||
public static String getBuildTimestamp() { |
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.
Read the build timestamp from the git.properties
file
String timestamp = getBuildTimestamp(); | ||
System.out.println("KBase SDK version " + VERSION | ||
+ (timestamp == null ? "" : ("_" + timestamp)) | ||
+ (gitCommit == null ? "" : (" (commit " + gitCommit + ")"))); |
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.
Include the build date and time with the kb-sdk version.
The version string now looks like this:
KBase SDK version 1.2.0_20200611-1439 (commit 7e58f55ad589fa64f83804c2dc9e380620210c45)
(from GitHub Actions output)
@@ -169,19 +169,16 @@ public void initialize(boolean example) throws Exception { | |||
} | |||
|
|||
switch(this.language) { | |||
// Perl just needs an impl file and a start server script | |||
// start_server scripts are generated by the Makefile |
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.
clean up comments and remove commented-out lines
false, // core or sync clients | ||
false, // dynamic client | ||
null, //tagVer | ||
true, // async clients |
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.
whitespace changes for nicer alignment
@@ -38,6 +38,11 @@ public ConfigLoader(Properties props, boolean testMode, | |||
if (authUrl == null) | |||
throw new IllegalStateException("Error: 'auth_service_url' parameter is not set in " + | |||
configPathInfo); | |||
endPoint = props.getProperty("kbase_endpoint"); |
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.
moved this check up so that kb-sdk will fail earlier if the kbase_endpoint
property is not set
callbackUrl == null | ||
? "http://fakecallbackurl" | ||
: callbackUrl.toExternalForm() | ||
).exec(tlDir).getExitCode(); |
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.
Whitespace changes only -- an upcoming PR has changes to this command and this reformatting makes them easier to understand.
Runtime.getRuntime().exec(cmd.cmdParts, null, workDir); | ||
process = cmd.cmdLine != null | ||
? Runtime.getRuntime().exec(cmd.cmdLine, null, workDir) | ||
: Runtime.getRuntime().exec(cmd.cmdParts, null, workDir); |
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.
whitespace changes only.
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 seems mostly innocuous and it's good to have some automated testing even if it doesn't test most of the code base.
That being said, this is critical infrastructure and making changes without having a real test suite running makes me very nervous.
…trieval of information from git.properties file.
…tarting kb-sdk. Add release notes. Fix KBase report class name error in Java version.
a13df0a
to
9ac1aba
Compare
@@ -22,7 +22,7 @@ import assemblyutil.GetAssemblyParams; | |||
import assemblyutil.SaveAssemblyParams; | |||
import kbasereport.CreateParams; | |||
import kbasereport.KBaseReportClient; | |||
import kbasereport.Report; | |||
import kbasereport.SimpleReport; |
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.
Java bug fix - incorrect class name.
GitHub Actions results for commit 9ac1aba: https://github.com/ialarmedalien/kb_sdk/actions/runs/137434654 |
return gitCommit; | ||
propertyValue = gitProps.getProperty(propertyToGet); | ||
} catch (Exception e) { | ||
showError("Error while retrieving version information", e.getMessage()); |
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.
showError
just prints the error, it doesn't exit. I think you'll have to do something else here to stop execution.
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 it's necessary to stop execution if the git.properties
file can't be found or these properties aren't available -- it's basically just adding in some extra "nice to have" information, it isn't mission critical. The properties file is generated during the build process and deleting it afterwards had no effect on the functioning of kb-sdk.
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.
But why not? If it's not there, clearly something went wrong with the build. Reduce runtime variables IMO.
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.
My thinking is more along the lines of "I don't want to give kb-sdk a reason to die unexpectedly", plus I couldn't create a situation manually where kb-sdk built successfully but the git.properties
file was not present.
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'm thinking I don't want unexpected behavior from the SDK when something's broken. I want it to fail fast.
plus I couldn't create a situation manually where kb-sdk built successfully but the git.properties file was not present.
Then failing won't cause any problems in practice unless something is really wrong, so might as well fail.
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, added a System.exit(1);
after emitting the error message.
fail-fast: false | ||
matrix: | ||
os: [ubuntu-16.04, ubuntu-18.04, ubuntu-20.04] | ||
app: [WsLargeDataIO, KBaseReport] |
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.
Hmm... this means if those repos break then kb-sdk test also breaks. I understand why you're doing this but making the sdk build depend on outside repos building and testing correctly seems overly fragile.
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.
Also, neither of these repos test callback server functionality
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.
What would you suggest here? The tests are kind of moot anyway because the app base images may have a different version of kb-sdk on them, so the build/compile step won't really be testing the revised kb-sdk. There should be something to test that the changes aren't going to break existing repos.
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.
Well personally, I wouldn't test against outside repos and I would depend on a good suite of regression tests and quality PR reviews to ensure that changes don't break repos. So let's just make that happen yeah
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.
Hah! I have some ideas for setting up some better regression tests but I didn't want to put too much into this PR, especially since I am working around the knowledge that kb-sdk v1.1.0 to 1.2.0 introduces breaking changes in the python code which have been masked because the sdkbase repo has not been updated. 🤦
I really wish that the old testing mechanisms had not been disabled!
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.
Were they actually disabled? I just thought that no one could get them to run except me. I'm not even sure if I can get them to run at this point, so I wouldn't be surprised if bitrot had set in.
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 tried to get them going a while back, but they ran on a VM which has now disappeared, and the config/set up files were removed from the repo.
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 config/set up files were removed from the repo
That's just... wow.
This still seems off. The Java client doesn't know about the KBase report at all in general. The generated tests for the java module were using an incorrect class name. |
"Corrected a class name in the Java client generated by kb-sdk"? |
I would say 'Corrected a class name in the generated tests for the Java SDK module'. It doesn't really have anything to do with the Java client generally. If you want to be really specific then 'Corrected a class name for the Java KBaseReport client in the generated tests for the Java SDK module' |
Let's skip ci this time.
propertyValue = gitProps.getProperty(propertyToGet); | ||
} catch (Exception e) { | ||
showError("Error while retrieving version information from git.properties file: ", e.getMessage()); | ||
System.exit(1); |
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.
When I was looking at the module builder code earlier, I noticed that most of the methods returned the return code rather than calling exit() themselves. Does that need to happen here? I don't actually understand why they were passing back the return code, but I assume it's for some good reason.
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.
Maybe testability? If you return the code, you can test the method, but not if you call exit().
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 happens before any of the module builder methods are called, so you have to just exit. The module builder methods all expect an integer (representing success or otherwise) to be returned:
public static void main(String[] args) throws Exception {
// code adding the various valid commands and args to JCommander
// ModuleBuilder line 97: print name and version
printVersion();
// parse the arguments and gracefully catch any errors
try {
jc.parse(args);
} catch (RuntimeException e) {
showError("Command Line Argument Error", e.getMessage());
System.exit(1);
}
// snip some help command stuff
// if we get here, we have a valid command, so process it and do stuff
int returnCode = 0;
if(jc.getParsedCommand().equals(HELP_COMMAND)) {
showCommandUsage(jc,help,System.out);
} else if(jc.getParsedCommand().equals(INIT_COMMAND)) {
returnCode = runInitCommand(initArgs,jc);
// etc.
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.
Approving with trepidation as the test suite can't be run.
Some changes to prepare kb-sdk for generating GitHub actions and updating the default module builds.
The first commit is all whitespace changes -- my editor removes trailing whitespace and turns tabs into spaces, so I committed all the whitespace changes prior to the content changes. I would suggest viewing just the last three commits.
The changes in this PR comprise:
kb-sdk version
kb-sdk
functioning, in lieu of having proper tests.