Search in sources :

Example 1 with HdfsAction

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

the class CommandExecutor method createAction.

private SmartAction createAction(String name) throws IOException {
    SmartAction smartAction = actionRegistry.createAction(name);
    smartAction.setContext(smartContext);
    if (smartAction instanceof HdfsAction) {
        ((HdfsAction) smartAction).setDfsClient(new SmartDFSClient(ssm.getNamenodeURI(), smartContext.getConf(), getRpcServerAddress()));
    }
    smartAction.getActionStatus().setId(currentActionId);
    currentActionId++;
    return smartAction;
}
Also used : HdfsAction(org.smartdata.actions.hdfs.HdfsAction) SmartAction(org.smartdata.actions.SmartAction) SmartDFSClient(org.smartdata.client.SmartDFSClient)

Example 2 with HdfsAction

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

the class TestCommand method runHelper.

private Command runHelper() throws IOException {
    HdfsAction[] actions = new HdfsAction[4];
    // New action
    // actions[0] = new AllSsdFileAction();
    // actions[0].setDfsClient(client);
    // actions[0].setContext(new SmartContext(smartConf));
    // actions[0].init(new String[]{"/testMoveFile/file1"});
    // actions[1] = new MoveFileAction();
    // actions[1].setDfsClient(client);
    // actions[1].setContext(new SmartContext(smartConf));
    // actions[1].init(new String[]{"/testMoveFile/file2", "COLD"});
    actions[2] = new CacheFileAction();
    actions[2].setDfsClient(client);
    actions[2].setContext(new SmartContext(smartConf));
    actions[2].init(new String[] { "/testCacheFile" });
    // New Command
    Command cmd = new Command(actions, null);
    cmd.setId(1);
    cmd.setRuleId(1);
    cmd.setState(CommandState.PENDING);
    return cmd;
}
Also used : CacheFileAction(org.smartdata.actions.hdfs.CacheFileAction) HdfsAction(org.smartdata.actions.hdfs.HdfsAction) SmartContext(org.smartdata.SmartContext)

Example 3 with HdfsAction

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

the class TestCommandPool method runHelper.

private Command runHelper() throws IOException {
    HdfsAction[] actions = new HdfsAction[4];
    // New action
    // actions[0] = new MoveFileAction();
    // actions[0].setDfsClient(client);
    // actions[0].setContext(new SmartContext(smartConf));
    // actions[0].init(new String[]{"/testMoveFile/file1", "ALL_SSD"});
    // actions[0].getActionStatus().setId(UUID.randomUUID());
    // actions[1] = new MoveFileAction();
    // actions[1].setDfsClient(client);
    // actions[1].setContext(new SmartContext(smartConf));
    // actions[1].init(new String[]{"/testMoveFile/file2", "COLD"});
    // actions[1].getActionStatus().setId(UUID.randomUUID());
    actions[2] = new CacheFileAction();
    actions[2].setDfsClient(client);
    actions[2].setContext(new SmartContext(smartConf));
    actions[2].init(new String[] { "/testCacheFile" });
    // New Command
    Command cmd = new Command(actions, null);
    cmd.setId(1);
    cmd.setRuleId(1);
    cmd.setState(CommandState.PENDING);
    return cmd;
}
Also used : CacheFileAction(org.smartdata.actions.hdfs.CacheFileAction) HdfsAction(org.smartdata.actions.hdfs.HdfsAction) SmartContext(org.smartdata.SmartContext)

Aggregations

HdfsAction (org.smartdata.actions.hdfs.HdfsAction)3 SmartContext (org.smartdata.SmartContext)2 CacheFileAction (org.smartdata.actions.hdfs.CacheFileAction)2 SmartAction (org.smartdata.actions.SmartAction)1 SmartDFSClient (org.smartdata.client.SmartDFSClient)1