org.apache.flink.configuration.Configuration.getInteger()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(225)

本文整理了Java中org.apache.flink.configuration.Configuration.getInteger()方法的一些代码示例,展示了Configuration.getInteger()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.getInteger()方法的具体详情如下:
包路径:org.apache.flink.configuration.Configuration
类名称:Configuration
方法名:getInteger

Configuration.getInteger介绍

[英]Returns the value associated with the given key as an integer.
[中]以整数形式返回与给定键关联的值。

代码示例

代码示例来源:origin: apache/flink

@Override
public int getInteger(String key, int defaultValue) {
  return this.backingConfig.getInteger(this.prefix + key, defaultValue);
}

代码示例来源:origin: apache/flink

public int getWebFrontendPort() {
  return config.getInteger(WebOptions.PORT);
}

代码示例来源:origin: apache/flink

public Integer getVertexID() {
  return config.getInteger(VERTEX_NAME, -1);
}

代码示例来源:origin: apache/flink

public int getNumberOfOutputs() {
  return config.getInteger(NUMBER_OF_OUTPUTS, 0);
}

代码示例来源:origin: apache/flink

@Override
public int getInteger(ConfigOption<Integer> configOption, int overrideDefault) {
  return this.backingConfig.getInteger(configOption, overrideDefault);
}

代码示例来源:origin: apache/flink

public int getChainIndex() {
  return this.config.getInteger(CHAIN_INDEX, 0);
}

代码示例来源:origin: apache/flink

public CheckpointingMode getCheckpointMode() {
  int ordinal = config.getInteger(CHECKPOINT_MODE, -1);
  if (ordinal >= 0) {
    return CheckpointingMode.values()[ordinal];
  } else {
    return DEFAULT_CHECKPOINTING_MODE;
  }
}

代码示例来源:origin: apache/flink

@Override
public String getClusterDescription() {
  String host = config.getString(JobManagerOptions.ADDRESS, "");
  int port = config.getInteger(JobManagerOptions.PORT, -1);
  return "Standalone cluster at " + host + ":" + port;
}

代码示例来源:origin: apache/flink

private static MesosArtifactServer createArtifactServer(Configuration configuration, String hostname) throws Exception {
    final int artifactServerPort = configuration.getInteger(MesosOptions.ARTIFACT_SERVER_PORT, 0);

    // a random prefix is affixed to artifact URLs to ensure uniqueness in the Mesos fetcher cache
    final String artifactServerPrefix = UUID.randomUUID().toString();

    return new MesosArtifactServer(artifactServerPrefix, hostname, artifactServerPort, configuration);
  }
}

代码示例来源:origin: apache/flink

@Override
public int getInteger(ConfigOption<Integer> configOption) {
  return  this.backingConfig.getInteger(prefixOption(configOption, prefix));
}

代码示例来源:origin: apache/flink

public TimeCharacteristic getTimeCharacteristic() {
  int ordinal = config.getInteger(TIME_CHARACTERISTIC, -1);
  if (ordinal >= 0) {
    return TimeCharacteristic.values()[ordinal];
  } else {
    throw new CorruptConfigurationException("time characteristic is not set");
  }
}

代码示例来源:origin: apache/flink

public JobGraphGenerator(Configuration config) {
  this.defaultMaxFan = config.getInteger(AlgorithmOptions.SPILLING_MAX_FAN);
  this.defaultSortSpillingThreshold = config.getFloat(AlgorithmOptions.SORT_SPILLING_THRESHOLD);
  this.useLargeRecordHandler = config.getBoolean(
      ConfigConstants.USE_LARGE_RECORD_HANDLER_KEY,
      ConfigConstants.DEFAULT_USE_LARGE_RECORD_HANDLER);
}

代码示例来源:origin: apache/flink

@Override
public String getWebInterfaceURL() {
  final InetSocketAddress inetSocketAddressFromAkkaURL;
  try {
    inetSocketAddressFromAkkaURL = AkkaUtils.getInetSocketAddressFromAkkaURL(getClusterConnectionInfo().getAddress());
  } catch (Exception e) {
    throw new RuntimeException("Could not retrieve leader retrieval information.", e);
  }
  String host = inetSocketAddressFromAkkaURL.getHostName();
  int port = getFlinkConfiguration().getInteger(WebOptions.PORT);
  return "http://" +  host + ":" + port;
}

代码示例来源:origin: apache/flink

public static void writeFileInfoToConfig(String name, DistributedCacheEntry e, Configuration conf) {
  int num = conf.getInteger(CACHE_FILE_NUM, 0) + 1;
  conf.setInteger(CACHE_FILE_NUM, num);
  conf.setString(CACHE_FILE_NAME + num, name);
  conf.setString(CACHE_FILE_PATH + num, e.filePath);
  conf.setBoolean(CACHE_FILE_EXE + num, e.isExecutable || new File(e.filePath).canExecute());
  conf.setBoolean(CACHE_FILE_DIR + num, e.isZipped || new File(e.filePath).isDirectory());
  if (e.blobKey != null) {
    conf.setBytes(CACHE_FILE_BLOB_KEY + num, e.blobKey);
  }
}

代码示例来源:origin: apache/flink

@Override
public void open(Configuration config) {
  int val = config.getInteger(TEST_KEY, -1);
  Assert.assertEquals(TEST_VALUE, val);
}

代码示例来源:origin: apache/flink

public static RestClusterClientConfiguration fromConfiguration(Configuration config) throws ConfigurationException {
    RestClientConfiguration restClientConfiguration = RestClientConfiguration.fromConfiguration(config);

    final long awaitLeaderTimeout = config.getLong(RestOptions.AWAIT_LEADER_TIMEOUT);
    final int retryMaxAttempts = config.getInteger(RestOptions.RETRY_MAX_ATTEMPTS);
    final long retryDelay = config.getLong(RestOptions.RETRY_DELAY);

    return new RestClusterClientConfiguration(restClientConfiguration, awaitLeaderTimeout, retryMaxAttempts, retryDelay);
  }
}

代码示例来源:origin: apache/flink

protected StreamPlanEnvironment(ExecutionEnvironment env) {
  super();
  this.env = env;
  int parallelism = env.getParallelism();
  if (parallelism > 0) {
    setParallelism(parallelism);
  } else {
    // determine parallelism
    setParallelism(GlobalConfiguration.loadConfiguration().getInteger(CoreOptions.DEFAULT_PARALLELISM));
  }
}

代码示例来源:origin: apache/flink

public static void checkJobManagerAddress(Configuration config, String expectedAddress, int expectedPort) {
  String jobManagerAddress = config.getString(JobManagerOptions.ADDRESS);
  int jobManagerPort = config.getInteger(JobManagerOptions.PORT, -1);
  assertEquals(expectedAddress, jobManagerAddress);
  assertEquals(expectedPort, jobManagerPort);
}

代码示例来源:origin: apache/flink

private void createBroadcastVariable(PythonOperationInfo info) {
  UdfOperator<?> op1 = (UdfOperator<?>) sets.getDataSet(info.parentID);
  DataSet<?> op2 = sets.getDataSet(info.otherID);
  op1.withBroadcastSet(op2, info.name);
  Configuration c = op1.getParameters();
  if (c == null) {
    c = new Configuration();
  }
  int count = c.getInteger(PLANBINDER_CONFIG_BCVAR_COUNT, 0);
  c.setInteger(PLANBINDER_CONFIG_BCVAR_COUNT, count + 1);
  c.setString(PLANBINDER_CONFIG_BCVAR_NAME_PREFIX + count, info.name);
  op1.withParameters(c);
}

代码示例来源:origin: apache/flink

public static ClusterSpecification fromConfiguration(Configuration configuration) {
  int slots = configuration.getInteger(TaskManagerOptions.NUM_TASK_SLOTS, 1);
  int jobManagerMemoryMb = ConfigurationUtils.getJobManagerHeapMemory(configuration).getMebiBytes();
  int taskManagerMemoryMb = ConfigurationUtils.getTaskManagerHeapMemory(configuration).getMebiBytes();
  return new ClusterSpecificationBuilder()
    .setMasterMemoryMB(jobManagerMemoryMb)
    .setTaskManagerMemoryMB(taskManagerMemoryMb)
    .setNumberTaskManagers(1)
    .setSlotsPerTaskManager(slots)
    .createClusterSpecification();
}

相关文章