Skip to content

Conversation

@jovany-wang
Copy link
Contributor

@jovany-wang jovany-wang commented Dec 27, 2018

What do these changes do?

We do these things for supporting this:

  1. Lock the actor when call on an actor.
  2. Make currentTaskPutCount and currentTaskCallCount as atomic variables.
  3. Make objectStore as thread local.
  4. Use different currentThreadTaskIds in different threads.

Btw, the implementation of getCurrentThreadTaskId() is quoted from @kfstorm, thanks.

Related issue number

N/A

@jovany-wang
Copy link
Contributor Author

@kfstorm @chuxi cc

@jovany-wang jovany-wang changed the title [Java] Support call Ray.APIs in multi-threading in Java worker. [Java] Support to call Ray.APIs in multi-threading in Java worker. Dec 27, 2018
int arg = random.nextInt();
RayObject<Integer> obj = Ray.put(arg);
Assert.assertEquals(arg, (int) Ray.get(obj.getId()));
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also add a test case of calling Ray.wait here.

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/10441/
Test PASSed.

currentClassLoader = null;
currentTask = createDummyTask(workerMode, driverId);
mainThreadId = Thread.currentThread().getId();
multiThreadingWarned = new AtomicBoolean();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, set default value to false

Copy link
Contributor

@raulchen raulchen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM except one small comment.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/10442/
Test FAILed.

@raulchen raulchen changed the title [Java] Support to call Ray.APIs in multi-threading in Java worker. [Java] Support calling Ray APIs from multiple threads Dec 27, 2018
@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/10447/
Test FAILed.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/10450/
Test FAILed.

workerId = workerMode == WorkerMode.DRIVER ? driverId : UniqueId.randomId();
currentTaskPutCount = 0;
currentTaskCallCount = 0;
currentTaskPutCount = new AtomicInteger(0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these also be reset to 0 in setCurrentTask?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, @jovan-wong can you fix this?

public void setCurrentTask(TaskSpec currentTask) {
this.currentTask = currentTask;
currentTaskCallCount.set(0);
currentTaskCallCount.set(0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currentTaskPutCount?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/10467/
Test FAILed.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/10469/
Test FAILed.

@raulchen raulchen merged commit c59b506 into ray-project:master Dec 28, 2018
@jovany-wang jovany-wang deleted the java-threading-sync branch January 17, 2019 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants