Search in sources :

Example 1 with SmartContext

use of org.smartdata.SmartContext in project SSM by Intel-bigdata.

the class ActionMiniCluster method init.

@Before
public void init() throws Exception {
    SmartConf conf = new SmartConf();
    initConf(conf);
    cluster = new MiniDFSCluster.Builder(conf).numDataNodes(5).storagesPerDatanode(3).storageTypes(new StorageType[] { StorageType.DISK, StorageType.ARCHIVE, StorageType.SSD }).build();
    cluster.waitActive();
    dfs = cluster.getFileSystem();
    dfsClient = dfs.getClient();
    smartContext = new SmartContext(conf);
}
Also used : MiniDFSCluster(org.apache.hadoop.hdfs.MiniDFSCluster) SmartContext(org.smartdata.SmartContext) SmartConf(org.smartdata.conf.SmartConf) Before(org.junit.Before)

Example 2 with SmartContext

use of org.smartdata.SmartContext 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 SmartContext

use of org.smartdata.SmartContext 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

SmartContext (org.smartdata.SmartContext)3 CacheFileAction (org.smartdata.actions.hdfs.CacheFileAction)2 HdfsAction (org.smartdata.actions.hdfs.HdfsAction)2 MiniDFSCluster (org.apache.hadoop.hdfs.MiniDFSCluster)1 Before (org.junit.Before)1 SmartConf (org.smartdata.conf.SmartConf)1