Skip to content

Commit

Permalink
Added h2o:::.h2o.garbageCollect(h2oClient)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkraljevic committed May 19, 2015
1 parent ed59791 commit b179f61
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
11 changes: 11 additions & 0 deletions R/h2o-package/R/Internal.R
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ h2o.setLogPath <- function(path, type) {
.h2o.__SET_DOMAIN = "2/SetDomains.json"
.h2o.__PAGE_ALLMODELS = "2/Models.json"
.h2o.__GAINS <- "2/GainsLiftTable.json"
.h2o.__PAGE_GARBAGECOLLECT = "GarbageCollect.json"

.h2o.__PAGE_IMPUTE= "2/Impute.json"
.h2o.__PAGE_EXEC2 = "2/Exec2.json"
Expand Down Expand Up @@ -1054,3 +1055,13 @@ h2o.getFrame <- function(h2o, key) {
"gamma" = Gamma(link))
}
}

#
# This function is internal intentionally.
#
# Call it as:
# h2o:::.h2o.garbageCollect(localH2O)
#
.h2o.garbageCollect <- function(client) {
res = .h2o.__remoteSend(client, .h2o.__PAGE_GARBAGECOLLECT)
}
34 changes: 34 additions & 0 deletions src/main/java/water/api/GarbageCollect.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package water.api;

import water.DTask;
import water.H2O;
import water.H2ONode;
import water.RPC;
import water.util.Log;

public class GarbageCollect extends Request {
private static class GCTask extends DTask<GCTask> {
public GCTask() {
}

@Override public void compute2() {
Log.info("Calling System.gc() now...");
System.gc();
Log.info("System.gc() finished");
tryComplete();
}

@Override public byte priority() {
return H2O.MIN_HI_PRIORITY;
}
}

@Override public RequestBuilders.Response serve(){
for (H2ONode node : H2O.CLOUD._memary) {
GCTask t = new GCTask();
new RPC<GCTask>(node, t).call().get();
}

return RequestBuilders.Response.doneEmpty();
}
}
2 changes: 2 additions & 0 deletions src/main/java/water/api/RequestServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ public enum API_VERSION {
registerRequest(new UnlockKeys());
registerRequest(new Order());
registerRequest(new RemoveVec());
registerRequest(new GarbageCollect());
} else {
Request.addToNavbar(registerRequest(new MatrixMultiply()), "Matrix Multiply", "Beta");
Request.addToNavbar(registerRequest(new hex.LR2()), "Linear Regression2", "Beta");
Expand All @@ -189,6 +190,7 @@ public enum API_VERSION {
Request.addToNavbar(registerRequest(new UnlockKeys()), "Unlock Keys (use with caution)","Beta");
Request.addToNavbar(registerRequest(new Order()), "Order", "Beta");
Request.addToNavbar(registerRequest(new RemoveVec()), "RemoveVec", "Beta");
Request.addToNavbar(registerRequest(new GarbageCollect()), "GarbageCollect", "Beta");
}

registerRequest(new Up());
Expand Down

0 comments on commit b179f61

Please sign in to comment.