@@ -0,0 +1,1937 @@
+package tachyon.perf;%0A%0Aimport org.apache.log4j.Logger;%0A%0Aimport tachyon.perf.basic.PerfTask;%0Aimport tachyon.perf.basic.PerfTaskContext;%0Aimport tachyon.perf.basic.TaskConfiguration;%0Aimport tachyon.perf.basic.TaskType;%0A%0A/**%0A * Entry point for the Tachyon-Perf Slave program.%0A */%0Apublic class TachyonPerfSlave %7B%0A  private static final Logger LOG = Logger.getLogger(PerfConstants.PERF_LOGGER_TYPE);%0A%0A  public static void main(String%5B%5D args) %7B%0A    if (args.length %3C 3) %7B%0A      LOG.error(%22Wrong program arguments. Should be %3CNodeName%3E %3CTaskId%3E %3CTaskType%3E%22%0A          + %22See more in bin/tachyon-perf%22);%0A      System.exit(-1);%0A    %7D%0A%0A    String nodeName = null;%0A    int taskId = -1;%0A    String taskType = null;%0A    try %7B%0A      nodeName = args%5B0%5D;%0A      taskId = Integer.parseInt(args%5B1%5D);%0A      taskType = args%5B2%5D;%0A    %7D catch (Exception e) %7B%0A      LOG.error(%22Failed to parse the input args%22, e);%0A      System.exit(-1);%0A    %7D%0A%0A    try %7B%0A      TaskConfiguration taskConf = TaskConfiguration.get(taskType, true);%0A      PerfTask task = TaskType.get().getTaskClass(taskType);%0A      task.initialSet(taskId, nodeName, taskConf, taskType);%0A      PerfTaskContext taskContext = TaskType.get().getTaskContextClass(taskType);%0A      taskContext.initialSet(taskId, nodeName, taskType, taskConf);%0A%0A      MasterClient masterClient = new MasterClient();%0A      while (!masterClient.slave_register(taskId, nodeName, task.getCleanupDir())) %7B%0A        Thread.sleep(1000);%0A      %7D%0A%0A      masterClient.slave_ready(taskId, nodeName, task.setup(taskContext));%0A%0A      while (!masterClient.slave_canRun(taskId, nodeName)) %7B%0A        Thread.sleep(100);%0A      %7D%0A      if (!task.run(taskContext)) %7B%0A        masterClient.slave_finish(taskId, nodeName, false);%0A      %7D else %7B%0A        masterClient.slave_finish(taskId, nodeName,%0A            task.cleanup(taskContext) & taskContext.getSuccess());%0A      %7D%0A    %7D catch (Exception e) %7B%0A      LOG.error(%22Error in task%22, e);%0A    %7D%0A  %7D%0A%7D%0A

Add TachyonPerfSlave