Search in sources :

Example 1 with MoverStatus

use of org.smartdata.actions.hdfs.move.MoverStatus in project SSM by Intel-bigdata.

the class TestMoveFileAction method scheduleMoverWithPercentage.

private void scheduleMoverWithPercentage(String dir, String storageType, long totalSize, long totolBlocks) throws Exception {
    MoveFileAction moveFileAction = new MoveFileAction();
    moveFileAction.setDfsClient(dfsClient);
    moveFileAction.setContext(smartContext);
    moveFileAction.init(dir, storageType);
    ActionStatus status = moveFileAction.getActionStatus();
    moveFileAction.run();
    if (status instanceof MoverStatus) {
        MoverStatus moverStatus = (MoverStatus) status;
        while (!moverStatus.isFinished()) {
            System.out.println("Mover running time : " + StringUtils.formatTime(moverStatus.getRunningTime()));
            System.out.println("Moved/Total : " + moverStatus.getMovedBlocks() + "/" + moverStatus.getTotalBlocks());
            System.out.println("Move percentage : " + moverStatus.getPercentage() * 100 + "%");
            Assert.assertTrue(moverStatus.getPercentage() <= 1);
            Thread.sleep(1000);
        }
        System.out.println("Mover is finished.");
        Assert.assertEquals(1.0f, moverStatus.getPercentage(), 0.00001f);
        Assert.assertEquals(totalSize, moverStatus.getTotalSize());
        Assert.assertEquals(totolBlocks, moverStatus.getTotalBlocks());
    }
}
Also used : ActionStatus(org.smartdata.actions.ActionStatus) MoverStatus(org.smartdata.actions.hdfs.move.MoverStatus)

Example 2 with MoverStatus

use of org.smartdata.actions.hdfs.move.MoverStatus in project SSM by Intel-bigdata.

the class MoveFileAction method createStatus.

@Override
protected void createStatus() {
    this.actionStatus = new MoverStatus();
    resultOut = actionStatus.getResultPrintStream();
    logOut = actionStatus.getLogPrintStream();
}
Also used : MoverStatus(org.smartdata.actions.hdfs.move.MoverStatus)

Aggregations

MoverStatus (org.smartdata.actions.hdfs.move.MoverStatus)2 ActionStatus (org.smartdata.actions.ActionStatus)1