-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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] improve Java API module #2783
Conversation
Test FAILed. |
jenkins, retest this please |
Test FAILed. |
Test FAILed. |
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.
Left some comments. The others look pretty good to me.
return ins; | ||
} | ||
|
||
public static RayParameters getParams() { | ||
return params; | ||
} | ||
|
||
public abstract void cleanUp(); | ||
public abstract void shutdown(); |
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.
@Override
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
* RayObject<T> is a handle for T object, which may or may not be available now. | ||
* That said, RayObject can be viewed as a Future object with metadata. | ||
* Represents an object in the object store. | ||
* @param <T> The object type. |
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.
@param <T> The primitive type of an object.
?
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 actually a non-primitive type. In java, primitive types
are int, long, double, boolean, etc.
|
||
private final List<RayObject<T>> readyOnes; | ||
private final List<RayObject<T>> remainOnes; | ||
private final List<RayObject<T>> ready; |
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.
readys
and unreadys
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.
ready
is an adjective, not a noun.
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 it allowed to use an adj
to represent a member in Java?
public class RayCallGenerator extends BaseGenerator { | ||
|
||
/** | ||
* @return whole file content of `RayCall.java` |
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.
Whole
RayObject<Integer> result8 = Ray.call(Adder::testObjectList, adder); | ||
Assert.assertEquals(11, (int) result8.get()); | ||
public int incr(int delta) { | ||
value += delta; |
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 think increase
would be better.
But this is a test file, it's ok.
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.
incr
is a commonly used in code as an abbreviation of increase
. I think it would not cause ambiguity here.
RayLog.core.info(methods2.toString()); | ||
|
||
Assert.assertEquals(methods2.functions.size(), 9); | ||
Assert.assertEquals(methods2.staticFunctions.size(), 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.
one more line
@@ -15,6 +14,6 @@ public void testRunStarted(Description description) { | |||
|
|||
@Override | |||
public void testRunFinished(Result result) { | |||
RayRuntime.getInstance().cleanUp(); | |||
Ray.shutdown(); | |||
} | |||
} |
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 a new line.
Test PASSed. |
API module (
ray/java/api
dir) includes all public APIs provided by Ray, it should be the only module that normal Ray users need to face.The purpose of this PR to first improve the code quality of the API module. Subsequent PRs will improve other modules later. The changes of this PR include the following aspects:
(Apologize for posting such a large PR. Java worker code has been lack of maintenance for a while. There're a lot of code quality issues that need to be fixed. We plan to use a couple of large PRs to address them. After that, future changes will come in small PRs.)