本文整理匯總了Java中azkaban.flow.Flow類的典型用法代碼示例。如果您正苦於以下問題:Java Flow類的具體用法?Java Flow怎麽用?Java Flow使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Flow類屬於azkaban.flow包,在下文中一共展示了Flow類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: fetchFlow
import azkaban.flow.Flow; //導入依賴的package包/類
@Override
public Flow fetchFlow(Project project, String flowId)
throws ProjectManagerException {
QueryRunner runner = createQueryRunner();
ProjectFlowsResultHandler handler = new ProjectFlowsResultHandler();
try {
List<Flow> flows =
runner.query(ProjectFlowsResultHandler.SELECT_PROJECT_FLOW, handler,
project.getId(), project.getVersion(), flowId);
if (flows.isEmpty()) {
return null;
} else {
return flows.get(0);
}
} catch (SQLException e) {
throw new ProjectManagerException("Error fetching flow " + flowId, e);
}
}
示例2: ajaxFetchFlowDetails
import azkaban.flow.Flow; //導入依賴的package包/類
private void ajaxFetchFlowDetails(Project project,
HashMap<String, Object> ret, HttpServletRequest req)
throws ServletException {
String flowName = getParam(req, "flow");
Flow flow = null;
try {
flow = project.getFlow(flowName);
if (flow == null) {
ret.put("error", "Flow " + flowName + " not found.");
return;
}
ret.put("jobTypes", getFlowJobTypes(flow));
} catch (AccessControlException e) {
ret.put("error", e.getMessage());
}
}
示例3: ajaxAttemptExecuteFlow
import azkaban.flow.Flow; //導入依賴的package包/類
private void ajaxAttemptExecuteFlow(HttpServletRequest req, HttpServletResponse resp, HashMap<String, Object> ret, User user)
throws ServletException {
String projectName = getParam(req, "project");
String flowId = getParam(req, "flow");
Project project =
getProjectAjaxByPermission(ret, projectName, user, Type.EXECUTE);
if (project == null) {
ret.put("error", "Project '" + projectName + "' doesn't exist.");
return;
}
ret.put("flow", flowId);
Flow flow = project.getFlow(flowId);
if (flow == null) {
ret.put("error", "Flow '" + flowId + "' cannot be found in project "
+ project);
return;
}
if (executorManager.getMaintenanceMode()) {
ret.put("error", "Azkaban is in maintenance mode, please submit flow latter.");
return;
}
ajaxExecuteFlow(req, resp, ret, user);
}
示例4: uploadFlow
import azkaban.flow.Flow; //導入依賴的package包/類
private void uploadFlow(Connection connection, Project project, int version,
Flow flow, EncodingType encType) throws ProjectManagerException,
IOException {
QueryRunner runner = new QueryRunner();
String json = JSONUtils.toJSON(flow.toObject());
byte[] stringData = json.getBytes("UTF-8");
byte[] data = stringData;
if (encType == EncodingType.GZIP) {
data = GZIPUtils.gzipBytes(stringData);
}
logger.info("Flow upload " + flow.getId() + " is byte size " + data.length);
final String INSERT_FLOW =
"INSERT INTO project_flows (project_id, version, flow_id, modified_time, encoding_type, json) values (?,?,?,?,?,?)";
try {
runner.update(connection, INSERT_FLOW, project.getId(), version,
flow.getId(), System.currentTimeMillis(), encType.getNumVal(), data);
} catch (SQLException e) {
throw new ProjectManagerException("Error inserting flow " + flow.getId(),
e);
}
}
示例5: fetchAllProjectFlows
import azkaban.flow.Flow; //導入依賴的package包/類
@Override
public List<Flow> fetchAllProjectFlows(Project project)
throws ProjectManagerException {
QueryRunner runner = createQueryRunner();
ProjectFlowsResultHandler handler = new ProjectFlowsResultHandler();
List<Flow> flows = null;
try {
flows =
runner.query(ProjectFlowsResultHandler.SELECT_ALL_PROJECT_FLOWS,
handler, project.getId(), project.getVersion());
} catch (SQLException e) {
throw new ProjectManagerException("Error fetching flows from project "
+ project.getName() + " version " + project.getVersion(), e);
}
return flows;
}
示例6: createExecutableFlow
import azkaban.flow.Flow; //導入依賴的package包/類
public static ExecutableFlow createExecutableFlow(String projectName,
String flowName) throws IOException {
File jsonFlowFile = getFlowDir(projectName, flowName);
@SuppressWarnings("unchecked")
HashMap<String, Object> flowObj =
(HashMap<String, Object>) JSONUtils.parseJSONFromFile(jsonFlowFile);
Flow flow = Flow.flowFromObject(flowObj);
Project project = new Project(1, "flow");
HashMap<String, Flow> flowMap = new HashMap<String, Flow>();
flowMap.put(flow.getId(), flow);
project.setFlows(flowMap);
ExecutableFlow execFlow = new ExecutableFlow(project, flow);
return execFlow;
}
示例7: testExecutorFlowJson
import azkaban.flow.Flow; //導入依賴的package包/類
@Test
public void testExecutorFlowJson() throws Exception {
Flow flow = project.getFlow("jobe");
Assert.assertNotNull(flow);
ExecutableFlow exFlow = new ExecutableFlow(project, flow);
Object obj = exFlow.toObject();
String exFlowJSON = JSONUtils.toJSON(obj);
@SuppressWarnings("unchecked")
Map<String, Object> flowObjMap =
(Map<String, Object>) JSONUtils.parseJSONFromString(exFlowJSON);
ExecutableFlow parsedExFlow =
ExecutableFlow.createExecutableFlowFromObject(flowObjMap);
testEquals(exFlow, parsedExFlow);
}
示例8: createExecutablePair
import azkaban.flow.Flow; //導入依賴的package包/類
private Pair<ExecutionReference, ExecutableFlow> createExecutablePair(
String flowName, int execId) throws IOException {
File jsonFlowFile = getFlowDir(flowName);
@SuppressWarnings("unchecked")
HashMap<String, Object> flowObj =
(HashMap<String, Object>) JSONUtils.parseJSONFromFile(jsonFlowFile);
Flow flow = Flow.flowFromObject(flowObj);
Project project = new Project(1, "flow");
HashMap<String, Flow> flowMap = new HashMap<String, Flow>();
flowMap.put(flow.getId(), flow);
project.setFlows(flowMap);
ExecutableFlow execFlow = new ExecutableFlow(project, flow);
execFlow.setExecutionId(execId);
ExecutionReference ref = new ExecutionReference(execId);
return new Pair<ExecutionReference, ExecutableFlow>(ref, execFlow);
}
示例9: createFlowRunner
import azkaban.flow.Flow; //導入依賴的package包/類
private FlowRunner createFlowRunner(EventCollectorListener eventCollector,
String flowName, FailureAction action) throws Exception {
Flow flow = flowMap.get(flowName);
int exId = id++;
ExecutableFlow exFlow = new ExecutableFlow(project, flow);
exFlow.setExecutionPath(workingDir.getPath());
exFlow.setExecutionId(exId);
Map<String, String> flowParam = new HashMap<String, String>();
flowParam.put("param4", "override.4");
flowParam.put("param10", "override.10");
flowParam.put("param11", "override.11");
exFlow.getExecutionOptions().addAllFlowParameters(flowParam);
exFlow.getExecutionOptions().setFailureAction(action);
fakeExecutorLoader.uploadExecutableFlow(exFlow);
FlowRunner runner = new FlowRunner(
fakeExecutorLoader.fetchExecutableFlow(exId), fakeExecutorLoader,
fakeProjectLoader, jobtypeManager);
runner.addListener(eventCollector);
return runner;
}
示例10: prepareExecDir
import azkaban.flow.Flow; //導入依賴的package包/類
private ExecutableFlow prepareExecDir(File execDir, String flowName,
int execId) throws IOException {
synchronized (this) {
FileUtils.copyDirectory(execDir, workingDir);
}
File jsonFlowFile = new File(workingDir, flowName + ".flow");
@SuppressWarnings("unchecked")
HashMap<String, Object> flowObj =
(HashMap<String, Object>) JSONUtils.parseJSONFromFile(jsonFlowFile);
Project project = new Project(1, "myproject");
project.setVersion(2);
Flow flow = Flow.flowFromObject(flowObj);
ExecutableFlow execFlow = new ExecutableFlow(project, flow);
execFlow.setExecutionId(execId);
execFlow.setExecutionPath(workingDir.getPath());
return execFlow;
}
示例11: createFlowRunner
import azkaban.flow.Flow; //導入依賴的package包/類
private FlowRunner createFlowRunner(String flowName,
HashMap<String, String> flowParams) throws Exception {
Flow flow = flowMap.get(flowName);
int exId = id++;
ExecutableFlow exFlow = new ExecutableFlow(project, flow);
exFlow.setExecutionPath(workingDir.getPath());
exFlow.setExecutionId(exId);
exFlow.getExecutionOptions().addAllFlowParameters(flowParams);
fakeExecutorLoader.uploadExecutableFlow(exFlow);
FlowRunner runner =
new FlowRunner(fakeExecutorLoader.fetchExecutableFlow(exId),
fakeExecutorLoader, fakeProjectLoader, jobtypeManager);
return runner;
}
示例12: createFlowRunner
import azkaban.flow.Flow; //導入依賴的package包/類
private FlowRunner createFlowRunner(EventCollectorListener eventCollector,
String flowName, String groupName, ExecutionOptions options)
throws Exception {
Flow flow = flowMap.get(flowName);
int exId = id++;
ExecutableFlow exFlow = new ExecutableFlow(project, flow);
exFlow.setExecutionPath(workingDir.getPath());
exFlow.setExecutionId(exId);
Map<String, String> flowParam = new HashMap<String, String>();
flowParam.put("group", groupName);
options.addAllFlowParameters(flowParam);
exFlow.setExecutionOptions(options);
fakeExecutorLoader.uploadExecutableFlow(exFlow);
FlowRunner runner =
new FlowRunner(fakeExecutorLoader.fetchExecutableFlow(exId),
fakeExecutorLoader, fakeProjectLoader, jobtypeManager);
runner.addListener(eventCollector);
return runner;
}
示例13: prepareExecDir
import azkaban.flow.Flow; //導入依賴的package包/類
private ExecutableFlow prepareExecDir(File workingDir, File execDir,
String flowName, int execId) throws IOException {
FileUtils.copyDirectory(execDir, workingDir);
File jsonFlowFile = new File(workingDir, flowName + ".flow");
@SuppressWarnings("unchecked")
HashMap<String, Object> flowObj =
(HashMap<String, Object>) JSONUtils.parseJSONFromFile(jsonFlowFile);
Project project = new Project(1, "test");
Flow flow = Flow.flowFromObject(flowObj);
ExecutableFlow execFlow = new ExecutableFlow(project, flow);
execFlow.setExecutionId(execId);
execFlow.setExecutionPath(workingDir.getPath());
return execFlow;
}
示例14: createFlowRunner
import azkaban.flow.Flow; //導入依賴的package包/類
private FlowRunner createFlowRunner(EventCollectorListener eventCollector, String flowName, FailureAction action) throws Exception {
Flow flow = flowMap.get(flowName);
int exId = id++;
ExecutableFlow exFlow = new ExecutableFlow(project, flow);
exFlow.setExecutionPath(workingDir.getPath());
exFlow.setExecutionId(exId);
Map<String, String> flowParam = new HashMap<String, String>();
flowParam.put("param4", "override.4");
flowParam.put("param10", "override.10");
flowParam.put("param11", "override.11");
exFlow.getExecutionOptions().addAllFlowParameters(flowParam);
exFlow.getExecutionOptions().setFailureAction(action);
fakeExecutorLoader.uploadExecutableFlow(exFlow);
FlowRunner runner = new FlowRunner(fakeExecutorLoader.fetchExecutableFlow(exId), fakeExecutorLoader, fakeProjectLoader, jobtypeManager);
runner.addListener(eventCollector);
return runner;
}
示例15: prepareExecDir
import azkaban.flow.Flow; //導入依賴的package包/類
private ExecutableFlow prepareExecDir(File execDir, String flowName, int execId) throws IOException {
synchronized ( this) {
FileUtils.copyDirectory(execDir, workingDir);
}
File jsonFlowFile = new File(workingDir, flowName + ".flow");
@SuppressWarnings("unchecked")
HashMap<String, Object> flowObj = (HashMap<String, Object>) JSONUtils.parseJSONFromFile(jsonFlowFile);
Project project = new Project(1, "myproject");
project.setVersion(2);
Flow flow = Flow.flowFromObject(flowObj);
ExecutableFlow execFlow = new ExecutableFlow(project, flow);
execFlow.setExecutionId(execId);
execFlow.setExecutionPath(workingDir.getPath());
return execFlow;
}