/** * The onStarting event is fired when a Flow instance receives the start() message. A Flow is cut * down into executing units called stepFlow. A stepFlow contains a stepFlowJob which represents * the mapreduce job to be submitted to Hadoop. The ambrose graph is constructed from the step * graph found in flow object. * * @param flow the flow. */ @Override @SuppressWarnings("unchecked") public void onStarting(Flow flow) { // init flow List<FlowStep> steps = flow.getFlowSteps(); totalNumberOfJobs = steps.size(); currentFlowId = flow.getID(); Properties props = new Properties(); props.putAll(flow.getConfigAsProperties()); try { statsWriteService.initWriteService(props); } catch (IOException e) { LOG.error("Failed to initialize statsWriteService", e); } // convert graph from cascading to ambrose AmbroseCascadingGraphConverter converter = new AmbroseCascadingGraphConverter(Flows.getStepGraphFrom(flow), nodesByName); converter.convert(); AmbroseUtils.sendDagNodeNameMap(statsWriteService, currentFlowId, nodesByName); }
currentFlowId = flow.getID();
@Override public String getID() { return flow.getID(); }
public void setFlow( Flow<Config> flow ) { this.flow = flow; this.flowID = flow.getID(); this.flowName = flow.getName(); }
public static String getNameOrID( Flow flow ) { if( flow == null ) return null; if( flow.getName() != null ) return flow.getName(); return flow.getID().substring( 0, 6 ); }
@Override public void cancel() throws SQLException { try { if( !parent.isClosed() ) parent.cancel(); } finally { Flow flow = lingualConnection.getCurrentFlow(); if( flow != null ) { LOG.info( "stopping flow: {}", flow.getID() ); flow.stop(); } } }
/** * The onStarting event is fired when a Flow instance receives the start() message. A Flow is cut * down into executing units called stepFlow. A stepFlow contains a stepFlowJob which represents * the mapreduce job to be submitted to Hadoop. The ambrose graph is constructed from the step * graph found in flow object. * * @param flow the flow. */ @Override @SuppressWarnings("unchecked") public void onStarting(Flow flow) { // init flow List<FlowStep> steps = flow.getFlowSteps(); totalNumberOfJobs = steps.size(); currentFlowId = flow.getID(); Properties props = new Properties(); props.putAll(flow.getConfigAsProperties()); try { statsWriteService.initWriteService(props); } catch (IOException e) { LOG.error("Failed to initialize statsWriteService", e); } // convert graph from cascading to ambrose AmbroseCascadingGraphConverter converter = new AmbroseCascadingGraphConverter(Flows.getStepGraphFrom(flow), nodesByName); converter.convert(); AmbroseUtils.sendDagNodeNameMap(statsWriteService, currentFlowId, nodesByName); }
currentFlowId = flow.getID();
@Test public void testFlowID() throws Exception { Tap source = new Lfs( new TextLine(), "input/path" ); Tap sink = new Hfs( new TextLine(), "output/path", SinkMode.REPLACE ); Pipe pipe = new Pipe( "test" ); Map<Object, Object> props = getProperties(); Flow flow1 = getPlatform().getFlowConnector( props ).connect( source, sink, pipe ); // System.out.println( "flow.getID() = " + flow1.getID() ); assertNotNull( "missing id", flow1.getID() ); assertNotNull( "missing id in conf", flow1.getProperty( "cascading.flow.id" ) ); Flow flow2 = getPlatform().getFlowConnector( props ).connect( source, sink, pipe ); assertTrue( "same id", !flow1.getID().equalsIgnoreCase( flow2.getID() ) ); }
@Test public void testFlowID() throws Exception { Tap source = new Lfs( new TextLine(), "input/path" ); Tap sink = new Hfs( new TextLine(), "output/path", SinkMode.REPLACE ); Pipe pipe = new Pipe( "test" ); Map<Object, Object> props = getProperties(); Flow flow1 = getPlatform().getFlowConnector( props ).connect( source, sink, pipe ); // System.out.println( "flow.getID() = " + flow1.getID() ); assertNotNull( "missing id", flow1.getID() ); assertNotNull( "missing id in conf", flow1.getProperty( "cascading.flow.id" ) ); Flow flow2 = getPlatform().getFlowConnector( props ).connect( source, sink, pipe ); assertTrue( "same id", !flow1.getID().equalsIgnoreCase( flow2.getID() ) ); }