Examples of LocalEnvironment


Examples of com.odiago.flumebase.exec.local.LocalEnvironment

    streamBuilder.setLocal(false);
    streamBuilder.addField("x", Type.getPrimitive(Type.TypeName.STRING));
    streamBuilder.addField("y", Type.getPrimitive(Type.TypeName.INT));

    getSymbolTable().addSymbol(streamBuilder.build());
    LocalEnvironment env = getEnvironment();
    env.connect();

    // Test the first query.
    LOG.debug("Running first query");
    getConf().set(SelectStmt.CLIENT_SELECT_TARGET_KEY, "select-out");

    QuerySubmitResponse selectResponse1 = env.submitQuery(
        "SELECT * FROM inputstream",
        getQueryOpts());
    assertNotNull(selectResponse1);
    FlowId queryId1 = selectResponse1.getFlowId();
    assertNotNull(queryId1);

    // Put some data into the stream.
    BufferedWriter w = new BufferedWriter(new FileWriter(sourceFile));
    try {
      w.write("line1,1\n");
      w.write("line2,2\n");
      w.write("line3,3\n");
    } finally {
      w.close();
    }

    MemoryOutputElement output1 = getOutput("select-out");
    assertNotNull(output1);
    SelectableList<GenericData.Record> outRecords1 = output1.getRecords();
    synchronized (outRecords1) {
      while (outRecords1.size() < 3) {
        outRecords1.wait();
      }

      for(GenericData.Record r : outRecords1) {
        LOG.debug("query 1 got " + r.get("x"));
      }

      this.assertRecordExists(outRecords1, "x", new Utf8("line1"));
      this.assertRecordExists(outRecords1, "x", new Utf8("line2"));
      this.assertRecordExists(outRecords1, "x", new Utf8("line3"));
    }

    LOG.debug("first query SUCCESS");

    if (killFirstQuery) {
      LOG.debug("Canceling first query");
      env.cancelFlow(queryId1);
      joinFlow(queryId1);
      LOG.debug("First query canceled.");
    }

    // Test the second query.
    LOG.debug("Running second query");
    getConf().set(SelectStmt.CLIENT_SELECT_TARGET_KEY, "select-out2");

    QuerySubmitResponse selectResponse2 = env.submitQuery(
        "SELECT * FROM inputstream WHERE y = 6",
        getQueryOpts());
    assertNotNull(selectResponse2);
    FlowId queryId2 = selectResponse2.getFlowId();
    assertNotNull(queryId2);

    // Add more data to the stream.
    w = new BufferedWriter(new FileWriter(sourceFile, true));
    try {
      w.write("line4,4\n");
      w.write("line5,5\n");
      w.write("line6,6\n");
    } finally {
      w.close();
    }
   
    MemoryOutputElement output2 = getOutput("select-out2");
    assertNotNull(output2);
    SelectableList<GenericData.Record> outRecords2 = output2.getRecords();
    synchronized (outRecords2) {
      while (outRecords2.size() < 1) {
        outRecords2.wait();
      }

      for(GenericData.Record r : outRecords2) {
        LOG.debug("query 2 got " + r.get("x"));
      }

      this.assertRecordFields(outRecords2, "y", Integer.valueOf(6), "x", new Utf8("line6"));
    }
    LOG.debug("second query SUCCESS");

    if (!killFirstQuery) {
      // Double check to ensure that the first query received those additional records.
      synchronized (outRecords1) {
        while (outRecords1.size() < 6) {
          outRecords1.wait();
        }

        for(GenericData.Record r : outRecords1) {
          LOG.debug("second time around, query 1 got " + r.get("x"));
        }

        this.assertRecordExists(outRecords1, "x", new Utf8("line4"));
        this.assertRecordExists(outRecords1, "x", new Utf8("line5"));
        this.assertRecordExists(outRecords1, "x", new Utf8("line6"));
      }

      LOG.debug("first query CONTINUED SUCCESS");
      LOG.debug("Now we're killing the first query.");
      env.cancelFlow(queryId1);
      joinFlow(queryId1);
    }

    LOG.debug("Killing 2nd query.");
    env.cancelFlow(queryId2);
    joinFlow(queryId2);
  }
View Full Code Here

Examples of com.odiago.flumebase.exec.local.LocalEnvironment

    getSymbolTable().addSymbol(stream);

    getConf().set(SelectStmt.CLIENT_SELECT_TARGET_KEY, "testSelect");

    // With all configuration complete, connect to the environment.
    LocalEnvironment env = getEnvironment();
    env.connect();

    // Run the query.
    QuerySubmitResponse response = env.submitQuery(query, getQueryOpts());
    FlowId id = response.getFlowId();
    assertNotNull(response.getMessage(), id);
    joinFlow(id);

    // Examine the response records.
View Full Code Here

Examples of com.odiago.flumebase.exec.local.LocalEnvironment

    getSymbolTable().addSymbol(rightStream);

    getConf().set(SelectStmt.CLIENT_SELECT_TARGET_KEY, "testJoin");

    // With all configuration complete, connect to the environment.
    LocalEnvironment env = getEnvironment();
    env.connect();

    // Run the query.
    QuerySubmitResponse response = env.submitQuery(query, getQueryOpts());
    FlowId id = response.getFlowId();
    assertNotNull(response.getMessage(), id);
    joinFlow(id);

    // Examine the response records.
View Full Code Here

Examples of com.odiago.flumebase.exec.local.LocalEnvironment

    getSymbolTable().addSymbol(stream);

    getConf().set(SelectStmt.CLIENT_SELECT_TARGET_KEY, "testGroupBy");

    // With all configuration complete, connect to the environment.
    LocalEnvironment env = getEnvironment();
    env.connect();

    // Run the query.
    QuerySubmitResponse response = env.submitQuery(query, getQueryOpts());
    FlowId id = response.getFlowId();
    if (expectFailure) {
      if (null == id) {
        // Our work here is done: we expected submission of the query to fail,
        // and it did. Return null for results.
View Full Code Here

Examples of com.odiago.flumebase.exec.local.LocalEnvironment

  private void connect(String host) {
    disconnect(); // Always disconnect from the current environment before reconnecting.
    try {
      if ("local".equals(host)) {
        LOG.info("Connecting to local environment.");
        mExecEnv = new LocalEnvironment(mConf);
      } else if ("none".equals(host)) {
        mExecEnv = new DummyExecEnv();
      } else {
        int portIndex = host.indexOf(':');
        int port = mConf.getInt(ServerMain.THRIFT_SERVER_PORT_KEY,
View Full Code Here

Examples of com.odiago.flumebase.exec.local.LocalEnvironment

    getSymbolTable().addSymbol(stream);

    getConf().set(SelectStmt.CLIENT_SELECT_TARGET_KEY, "testThroughput");

    // With all configuration complete, connect to the environment.
    LocalEnvironment env = getEnvironment();
    env.connect();

    long startTimestamp = System.currentTimeMillis();

    // Run the query.
    QuerySubmitResponse response = env.submitQuery(query, getQueryOpts());
    FlowId id = response.getFlowId();
    assertNotNull(response.getMessage(), id);
    joinFlow(id);

    long stopTimestamp = System.currentTimeMillis();
View Full Code Here

Examples of com.odiago.flumebase.exec.local.LocalEnvironment

  public void setUp() {
    mSymbolTable = new HashSymbolTable(new BuiltInSymbolTable());
    mConf = new Configuration();
    mOutputs = Collections.synchronizedMap(new HashMap<String, MemoryOutputElement>());
    mFlumeConfig = new EmbeddedFlumeConfig(mConf);
    mEnvironment = new LocalEnvironment(mConf, mSymbolTable, mOutputs, mFlumeConfig);
  }
View Full Code Here

Examples of com.odiago.flumebase.exec.local.LocalEnvironment

        strcatFunc.getArgumentTypes(), strcatFunc.getVarArgTypes()));

    getConf().set(SelectStmt.CLIENT_SELECT_TARGET_KEY, "testSelect");

    // With all configuration complete, connect to the environment.
    LocalEnvironment env = getEnvironment();
    env.connect();

    // Run the query.
    LOG.debug("Actually submitting to running environment");
    QuerySubmitResponse response = env.submitQuery(query, getQueryOpts());
    FlowId id = response.getFlowId();
    assertNotNull(response.getMessage(), id);
    joinFlow(id);
    LOG.debug("Flow runtime complete");
View Full Code Here

Examples of eu.stratosphere.api.java.LocalEnvironment

  }
 
  @Test(expected=InvalidProgramException.class)
  public void tryLocalEnvironmentExecution() throws Exception {
    new Client(configMock);
    new LocalEnvironment();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.