use of org.smartdata.hdfs.action.HdfsAction in project SSM by Intel-bigdata.
the class TestCmdlet method runHelper.
private Cmdlet runHelper() throws IOException {
SmartAction[] actions = new SmartAction[4];
// New action
// actions[0] = new AllSsdFileAction();
// actions[0].setDfsClient(client);
// actions[0].setContext(new SmartContext(smartConf));
// actions[0].getDNStorageReports(new String[]{"/testMoveFile/file1"});
// actions[1] = new MoveFileAction();
// actions[1].setDfsClient(client);
// actions[1].setContext(new SmartContext(smartConf));
// actions[1].getDNStorageReports(new String[]{"/testMoveFile/file2", "COLD"});
actions[2] = new CacheFileAction();
((HdfsAction) actions[2]).setDfsClient(dfsClient);
actions[2].setContext(smartContext);
Map<String, String> args = new HashMap();
args.put(CacheFileAction.FILE_PATH, "/testCacheFile");
actions[2].init(args);
// New Cmdlet
Cmdlet cmd = new Cmdlet(Arrays.asList(actions));
cmd.setId(1);
cmd.setRuleId(1);
cmd.setState(CmdletState.PENDING);
return cmd;
}
use of org.smartdata.hdfs.action.HdfsAction in project SSM by Intel-bigdata.
the class CmdletFactory method createAction.
public SmartAction createAction(long cmdletId, boolean isLastAction, LaunchAction launchAction) throws ActionException {
SmartAction smartAction = ActionRegistry.createAction(launchAction.getActionType());
smartAction.setContext(smartContext);
smartAction.setCmdletId(cmdletId);
smartAction.setLastAction(isLastAction);
smartAction.init(launchAction.getArgs());
smartAction.setActionId(launchAction.getActionId());
if (smartAction instanceof HdfsAction) {
try {
((HdfsAction) smartAction).setDfsClient(new SmartDFSClient(HadoopUtil.getNameNodeUri(smartContext.getConf()), smartContext.getConf(), getRpcServerAddress()));
} catch (IOException e) {
LOG.error("smartAction aid={} setDfsClient error", launchAction.getActionId(), e);
throw new ActionException(e);
}
}
/*
else if (smartAction instanceof AlluxioAction) {
FileSystem fs;
try {
fs = AlluxioUtil.getAlluxioFs(smartContext);
} catch (Exception e) {
LOG.error("smartAction aid={} alluxio filesystem error", launchAction.getActionId(), e);
throw new ActionException(e);
}
((AlluxioAction) smartAction).setFileSystem(fs);
}
*/
return smartAction;
}
Aggregations