Java Code Examples for com.datatorrent.stram.plan.logical.LogicalPlan#getValue()

The following examples show how to use com.datatorrent.stram.plan.logical.LogicalPlan#getValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StreamingContainerManager.java    From Bats with Apache License 2.0 6 votes vote down vote up
private FinalVars(LogicalPlan dag, long tms)
{
  Attribute.AttributeMap attributes = dag.getAttributes();
  /* try to align to it to please eyes. */
  windowStartMillis = tms - (tms % 1000);

  if (attributes.get(LogicalPlan.APPLICATION_PATH) == null) {
    throw new IllegalArgumentException("Not set: " + LogicalPlan.APPLICATION_PATH);
  }

  this.appPath = attributes.get(LogicalPlan.APPLICATION_PATH);

  if (attributes.get(LogicalPlan.STREAMING_WINDOW_SIZE_MILLIS) == null) {
    attributes.put(LogicalPlan.STREAMING_WINDOW_SIZE_MILLIS, 500);
  }
  if (attributes.get(LogicalPlan.CHECKPOINT_WINDOW_COUNT) == null) {
    attributes.put(LogicalPlan.CHECKPOINT_WINDOW_COUNT, 30000 / attributes.get(LogicalPlan.STREAMING_WINDOW_SIZE_MILLIS));
  }

  this.heartbeatTimeoutMillis = dag.getValue(LogicalPlan.HEARTBEAT_TIMEOUT_MILLIS);
  this.maxWindowsBehindForStats = dag.getValue(LogicalPlan.STATS_MAX_ALLOWABLE_WINDOWS_LAG);
  this.enableStatsRecording = dag.getValue(LogicalPlan.ENABLE_STATS_RECORDING);
  this.rpcLatencyCompensationSamples = dag.getValue(LogicalPlan.RPC_LATENCY_COMPENSATION_SAMPLES);
}
 
Example 2
Source File: StreamingContainerManager.java    From Bats with Apache License 2.0 6 votes vote down vote up
/**
 * Modify previously saved state to allow for re-launch of application.
 */
public void setApplicationId(LogicalPlan newApp, Configuration conf)
{
  LogicalPlan lp = physicalPlan.getLogicalPlan();
  String appId = newApp.getValue(LogicalPlan.APPLICATION_ID);
  String oldAppId = lp.getValue(LogicalPlan.APPLICATION_ID);
  if (oldAppId == null) {
    throw new AssertionError("Missing original application id");
  }

  lp.setAttribute(LogicalPlan.APPLICATION_ID, appId);
  lp.setAttribute(LogicalPlan.APPLICATION_PATH, newApp.assertAppPath());
  lp.setAttribute(Context.DAGContext.LIBRARY_JARS, newApp.getValue(Context.DAGContext.LIBRARY_JARS));
  lp.setAttribute(LogicalPlan.ARCHIVES, newApp.getValue(LogicalPlan.ARCHIVES));

  this.finals = new FinalVars(finals, lp);
  StorageAgent sa = lp.getValue(OperatorContext.STORAGE_AGENT);
  lp.setAttribute(OperatorContext.STORAGE_AGENT, updateStorageAgent(sa, oldAppId, appId, conf));
}
 
Example 3
Source File: StreamingContainerManager.java    From attic-apex-core with Apache License 2.0 6 votes vote down vote up
private FinalVars(LogicalPlan dag, long tms)
{
  Attribute.AttributeMap attributes = dag.getAttributes();
  /* try to align to it to please eyes. */
  windowStartMillis = tms - (tms % 1000);

  if (attributes.get(LogicalPlan.APPLICATION_PATH) == null) {
    throw new IllegalArgumentException("Not set: " + LogicalPlan.APPLICATION_PATH);
  }

  this.appPath = attributes.get(LogicalPlan.APPLICATION_PATH);

  if (attributes.get(LogicalPlan.STREAMING_WINDOW_SIZE_MILLIS) == null) {
    attributes.put(LogicalPlan.STREAMING_WINDOW_SIZE_MILLIS, 500);
  }
  if (attributes.get(LogicalPlan.CHECKPOINT_WINDOW_COUNT) == null) {
    attributes.put(LogicalPlan.CHECKPOINT_WINDOW_COUNT, 30000 / attributes.get(LogicalPlan.STREAMING_WINDOW_SIZE_MILLIS));
  }

  this.heartbeatTimeoutMillis = dag.getValue(LogicalPlan.HEARTBEAT_TIMEOUT_MILLIS);
  this.maxWindowsBehindForStats = dag.getValue(LogicalPlan.STATS_MAX_ALLOWABLE_WINDOWS_LAG);
  this.enableStatsRecording = dag.getValue(LogicalPlan.ENABLE_STATS_RECORDING);
  this.rpcLatencyCompensationSamples = dag.getValue(LogicalPlan.RPC_LATENCY_COMPENSATION_SAMPLES);
}
 
Example 4
Source File: StreamingContainerManager.java    From attic-apex-core with Apache License 2.0 6 votes vote down vote up
/**
 * Modify previously saved state to allow for re-launch of application.
 */
public void setApplicationId(LogicalPlan newApp, Configuration conf)
{
  LogicalPlan lp = physicalPlan.getLogicalPlan();
  String appId = newApp.getValue(LogicalPlan.APPLICATION_ID);
  String oldAppId = lp.getValue(LogicalPlan.APPLICATION_ID);
  if (oldAppId == null) {
    throw new AssertionError("Missing original application id");
  }

  lp.setAttribute(LogicalPlan.APPLICATION_ID, appId);
  lp.setAttribute(LogicalPlan.APPLICATION_PATH, newApp.assertAppPath());
  lp.setAttribute(Context.DAGContext.LIBRARY_JARS, newApp.getValue(Context.DAGContext.LIBRARY_JARS));
  lp.setAttribute(LogicalPlan.ARCHIVES, newApp.getValue(LogicalPlan.ARCHIVES));

  this.finals = new FinalVars(finals, lp);
  StorageAgent sa = lp.getValue(OperatorContext.STORAGE_AGENT);
  lp.setAttribute(OperatorContext.STORAGE_AGENT, updateStorageAgent(sa, oldAppId, appId, conf));
}
 
Example 5
Source File: StreamingContainerManager.java    From Bats with Apache License 2.0 5 votes vote down vote up
private FinalVars(FinalVars other, LogicalPlan dag)
{
  this.windowStartMillis = other.windowStartMillis;
  this.heartbeatTimeoutMillis = other.heartbeatTimeoutMillis;
  this.maxWindowsBehindForStats = other.maxWindowsBehindForStats;
  this.enableStatsRecording = other.enableStatsRecording;
  this.appPath = dag.getValue(LogicalPlan.APPLICATION_PATH);
  this.rpcLatencyCompensationSamples = other.rpcLatencyCompensationSamples;
}
 
Example 6
Source File: OperatorStatus.java    From Bats with Apache License 2.0 5 votes vote down vote up
public OperatorStatus(int operatorId, LogicalPlan.OperatorMeta om)
{
  this.operatorId = operatorId;
  this.operatorMeta = om;
  LogicalPlan dag = om.getDAG();
  throughputCalculationInterval = dag.getValue(LogicalPlan.THROUGHPUT_CALCULATION_INTERVAL);
  throughputCalculationMaxSamples = dag.getValue(LogicalPlan.THROUGHPUT_CALCULATION_MAX_SAMPLES);
  int heartbeatInterval = dag.getValue(LogicalPlan.HEARTBEAT_INTERVAL_MILLIS);

  cpuNanosPMSMA = new TimedMovingAverageLong(throughputCalculationMaxSamples, throughputCalculationInterval);
  latencyMA = new MovingAverageLong(throughputCalculationInterval / heartbeatInterval);
  checkpointTimeMA = new MovingAverageLong(throughputCalculationInterval / heartbeatInterval);
  this.windowProcessingTimeoutMillis = dag.getValue(LogicalPlan.STREAMING_WINDOW_SIZE_MILLIS)
    * om.getValue(OperatorContext.TIMEOUT_WINDOW_COUNT);
}
 
Example 7
Source File: StreamingContainerManager.java    From attic-apex-core with Apache License 2.0 5 votes vote down vote up
private FinalVars(FinalVars other, LogicalPlan dag)
{
  this.windowStartMillis = other.windowStartMillis;
  this.heartbeatTimeoutMillis = other.heartbeatTimeoutMillis;
  this.maxWindowsBehindForStats = other.maxWindowsBehindForStats;
  this.enableStatsRecording = other.enableStatsRecording;
  this.appPath = dag.getValue(LogicalPlan.APPLICATION_PATH);
  this.rpcLatencyCompensationSamples = other.rpcLatencyCompensationSamples;
}
 
Example 8
Source File: OperatorStatus.java    From attic-apex-core with Apache License 2.0 5 votes vote down vote up
public OperatorStatus(int operatorId, LogicalPlan.OperatorMeta om)
{
  this.operatorId = operatorId;
  this.operatorMeta = om;
  LogicalPlan dag = om.getDAG();
  throughputCalculationInterval = dag.getValue(LogicalPlan.THROUGHPUT_CALCULATION_INTERVAL);
  throughputCalculationMaxSamples = dag.getValue(LogicalPlan.THROUGHPUT_CALCULATION_MAX_SAMPLES);
  int heartbeatInterval = dag.getValue(LogicalPlan.HEARTBEAT_INTERVAL_MILLIS);

  cpuNanosPMSMA = new TimedMovingAverageLong(throughputCalculationMaxSamples, throughputCalculationInterval);
  latencyMA = new MovingAverageLong(throughputCalculationInterval / heartbeatInterval);
  checkpointTimeMA = new MovingAverageLong(throughputCalculationInterval / heartbeatInterval);
  this.windowProcessingTimeoutMillis = dag.getValue(LogicalPlan.STREAMING_WINDOW_SIZE_MILLIS)
    * om.getValue(OperatorContext.TIMEOUT_WINDOW_COUNT);
}