All Downloads are FREE. Search and download functionalities are using the official Maven repository.

water.api.RemoveAllHandler Maven / Gradle / Ivy

There is a newer version: 3.8.2.9
Show newest version
package water.api;

import water.Futures;
import water.H2O;
import water.Job;
import water.MRTask;
import water.util.Log;

// Best-effort cluster brain-wipe and reset.
// Useful between unrelated tests.
public class RemoveAllHandler extends Handler {
  @SuppressWarnings("unused") // called through reflection by RequestServer
  public RemoveAllV3 remove(int version, RemoveAllV3 u) {
    Log.info("Removing all objects");
    Futures fs = new Futures();
    // Cancel and remove leftover running jobs
    for( Job j : Job.jobs() ) { j.stop_requested(); j.remove(fs); }
    // Wipe out any and all session info
    if( InitIDHandler.SESSIONS != null ) {
      for(String k: InitIDHandler.SESSIONS.keySet() )
        (InitIDHandler.SESSIONS.get(k)).endQuietly(null);
      InitIDHandler.SESSIONS.clear();
    }
    fs.blockForPending();
    // Bulk brainless key removal.  Completely wipes all Keys without regard.
    new MRTask(H2O.MIN_HI_PRIORITY){
      @Override public void setupLocal() {  H2O.raw_clear();  water.fvec.Vec.ESPC.clear(); }
    }.doAllNodes();
    // Wipe the backing store without regard as well
    H2O.getPM().getIce().cleanUp();
    Log.info("Finished removing objects");
    return u;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy