Java源码示例:org.apache.flink.runtime.util.EnvironmentInformation
示例1
/**
* Creates an AmazonDynamoDBStreamsAdapterClient.
* Uses it as the internal client interacting with the DynamoDB streams.
*
* @param configProps configuration properties
* @return an AWS DynamoDB streams adapter client
*/
@Override
protected AmazonKinesis createKinesisClient(Properties configProps) {
ClientConfiguration awsClientConfig = new ClientConfigurationFactory().getConfig();
setAwsClientConfigProperties(awsClientConfig, configProps);
AWSCredentialsProvider credentials = getCredentialsProvider(configProps);
awsClientConfig.setUserAgentPrefix(
String.format(
USER_AGENT_FORMAT,
EnvironmentInformation.getVersion(),
EnvironmentInformation.getRevisionInformation().commitId));
AmazonDynamoDBStreamsAdapterClient adapterClient =
new AmazonDynamoDBStreamsAdapterClient(credentials, awsClientConfig);
if (configProps.containsKey(AWS_ENDPOINT)) {
adapterClient.setEndpoint(configProps.getProperty(AWS_ENDPOINT));
} else {
adapterClient.setRegion(Region.getRegion(
Regions.fromName(configProps.getProperty(AWS_REGION))));
}
return adapterClient;
}
示例2
/**
* Creates an Amazon Kinesis Client.
* @param configProps configuration properties containing the access key, secret key, and region
* @param awsClientConfig preconfigured AWS SDK client configuration
* @return a new Amazon Kinesis Client
*/
public static AmazonKinesis createKinesisClient(Properties configProps, ClientConfiguration awsClientConfig) {
// set a Flink-specific user agent
awsClientConfig.setUserAgentPrefix(String.format(USER_AGENT_FORMAT,
EnvironmentInformation.getVersion(),
EnvironmentInformation.getRevisionInformation().commitId));
// utilize automatic refreshment of credentials by directly passing the AWSCredentialsProvider
AmazonKinesisClientBuilder builder = AmazonKinesisClientBuilder.standard()
.withCredentials(AWSUtil.getCredentialsProvider(configProps))
.withClientConfiguration(awsClientConfig);
if (configProps.containsKey(AWSConfigConstants.AWS_ENDPOINT)) {
// Set signingRegion as null, to facilitate mocking Kinesis for local tests
builder.withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(
configProps.getProperty(AWSConfigConstants.AWS_ENDPOINT),
null));
} else {
builder.withRegion(Regions.fromName(configProps.getProperty(AWSConfigConstants.AWS_REGION)));
}
return builder.build();
}
示例3
public static void main(String[] args) {
// startup checks and logging
EnvironmentInformation.logEnvironmentInfo(LOG, MesosSessionClusterEntrypoint.class.getSimpleName(), args);
SignalHandler.register(LOG);
JvmShutdownSafeguard.installAsShutdownHook(LOG);
// load configuration incl. dynamic properties
CommandLineParser parser = new PosixParser();
CommandLine cmd;
try {
cmd = parser.parse(ALL_OPTIONS, args);
}
catch (Exception e){
LOG.error("Could not parse the command-line options.", e);
System.exit(STARTUP_FAILURE_RETURN_CODE);
return;
}
Configuration dynamicProperties = BootstrapTools.parseDynamicProperties(cmd);
Configuration configuration = MesosEntrypointUtils.loadConfiguration(dynamicProperties, LOG);
MesosSessionClusterEntrypoint clusterEntrypoint = new MesosSessionClusterEntrypoint(configuration, dynamicProperties);
ClusterEntrypoint.runClusterEntrypoint(clusterEntrypoint);
}
示例4
public static void main(String[] args) {
// startup checks and logging
EnvironmentInformation.logEnvironmentInfo(LOG, MesosJobClusterEntrypoint.class.getSimpleName(), args);
SignalHandler.register(LOG);
JvmShutdownSafeguard.installAsShutdownHook(LOG);
// load configuration incl. dynamic properties
CommandLineParser parser = new PosixParser();
CommandLine cmd;
try {
cmd = parser.parse(ALL_OPTIONS, args);
}
catch (Exception e){
LOG.error("Could not parse the command-line options.", e);
System.exit(STARTUP_FAILURE_RETURN_CODE);
return;
}
Configuration dynamicProperties = BootstrapTools.parseDynamicProperties(cmd);
Configuration configuration = MesosEntrypointUtils.loadConfiguration(dynamicProperties, LOG);
MesosJobClusterEntrypoint clusterEntrypoint = new MesosJobClusterEntrypoint(configuration, dynamicProperties);
ClusterEntrypoint.runClusterEntrypoint(clusterEntrypoint);
}
示例5
public static void main(String[] args) {
try {
// startup checks and logging
EnvironmentInformation.logEnvironmentInfo(LOG, "ZooKeeper Quorum Peer", args);
final ParameterTool params = ParameterTool.fromArgs(args);
final String zkConfigFile = params.getRequired("zkConfigFile");
final int peerId = params.getInt("peerId");
// Run quorum peer
runFlinkZkQuorumPeer(zkConfigFile, peerId);
}
catch (Throwable t) {
LOG.error("Error running ZooKeeper quorum peer: " + t.getMessage(), t);
System.exit(-1);
}
}
示例6
public static DashboardConfiguration from(long refreshInterval, ZonedDateTime zonedDateTime) {
final String flinkVersion = EnvironmentInformation.getVersion();
final EnvironmentInformation.RevisionInformation revision = EnvironmentInformation.getRevisionInformation();
final String flinkRevision;
if (revision != null) {
flinkRevision = revision.commitId + " @ " + revision.commitDate;
} else {
flinkRevision = "unknown revision";
}
return new DashboardConfiguration(
refreshInterval,
zonedDateTime.getZone().getDisplayName(TextStyle.FULL, Locale.getDefault()),
// convert zone date time into offset in order to not do the day light saving adaptions wrt the offset
zonedDateTime.toOffsetDateTime().getOffset().getTotalSeconds() * 1000,
flinkVersion,
flinkRevision);
}
示例7
public static void main(String[] args) {
// startup checks and logging
EnvironmentInformation.logEnvironmentInfo(LOG, StandaloneSessionClusterEntrypoint.class.getSimpleName(), args);
SignalHandler.register(LOG);
JvmShutdownSafeguard.installAsShutdownHook(LOG);
EntrypointClusterConfiguration entrypointClusterConfiguration = null;
final CommandLineParser<EntrypointClusterConfiguration> commandLineParser = new CommandLineParser<>(new EntrypointClusterConfigurationParserFactory());
try {
entrypointClusterConfiguration = commandLineParser.parse(args);
} catch (FlinkParseException e) {
LOG.error("Could not parse command line arguments {}.", args, e);
commandLineParser.printHelp(StandaloneSessionClusterEntrypoint.class.getSimpleName());
System.exit(1);
}
Configuration configuration = loadConfiguration(entrypointClusterConfiguration);
StandaloneSessionClusterEntrypoint entrypoint = new StandaloneSessionClusterEntrypoint(configuration);
ClusterEntrypoint.runClusterEntrypoint(entrypoint);
}
示例8
/**
* Creates an AmazonDynamoDBStreamsAdapterClient.
* Uses it as the internal client interacting with the DynamoDB streams.
*
* @param configProps configuration properties
* @return an AWS DynamoDB streams adapter client
*/
@Override
protected AmazonKinesis createKinesisClient(Properties configProps) {
ClientConfiguration awsClientConfig = new ClientConfigurationFactory().getConfig();
setAwsClientConfigProperties(awsClientConfig, configProps);
AWSCredentialsProvider credentials = getCredentialsProvider(configProps);
awsClientConfig.setUserAgentPrefix(
String.format(
USER_AGENT_FORMAT,
EnvironmentInformation.getVersion(),
EnvironmentInformation.getRevisionInformation().commitId));
AmazonDynamoDBStreamsAdapterClient adapterClient =
new AmazonDynamoDBStreamsAdapterClient(credentials, awsClientConfig);
if (configProps.containsKey(AWS_ENDPOINT)) {
adapterClient.setEndpoint(configProps.getProperty(AWS_ENDPOINT));
} else {
adapterClient.setRegion(Region.getRegion(
Regions.fromName(configProps.getProperty(AWS_REGION))));
}
return adapterClient;
}
示例9
/**
* Creates an Amazon Kinesis Client.
* @param configProps configuration properties containing the access key, secret key, and region
* @param awsClientConfig preconfigured AWS SDK client configuration
* @return a new Amazon Kinesis Client
*/
public static AmazonKinesis createKinesisClient(Properties configProps, ClientConfiguration awsClientConfig) {
// set a Flink-specific user agent
awsClientConfig.setUserAgentPrefix(String.format(USER_AGENT_FORMAT,
EnvironmentInformation.getVersion(),
EnvironmentInformation.getRevisionInformation().commitId));
// utilize automatic refreshment of credentials by directly passing the AWSCredentialsProvider
AmazonKinesisClientBuilder builder = AmazonKinesisClientBuilder.standard()
.withCredentials(AWSUtil.getCredentialsProvider(configProps))
.withClientConfiguration(awsClientConfig);
if (configProps.containsKey(AWSConfigConstants.AWS_ENDPOINT)) {
// Set signingRegion as null, to facilitate mocking Kinesis for local tests
builder.withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(
configProps.getProperty(AWSConfigConstants.AWS_ENDPOINT),
null));
} else {
builder.withRegion(Regions.fromName(configProps.getProperty(AWSConfigConstants.AWS_REGION)));
}
return builder.build();
}
示例10
public static void main(String[] args) {
// startup checks and logging
EnvironmentInformation.logEnvironmentInfo(LOG, MesosJobClusterEntrypoint.class.getSimpleName(), args);
SignalHandler.register(LOG);
JvmShutdownSafeguard.installAsShutdownHook(LOG);
// load configuration incl. dynamic properties
CommandLineParser parser = new PosixParser();
CommandLine cmd;
try {
cmd = parser.parse(ALL_OPTIONS, args);
}
catch (Exception e){
LOG.error("Could not parse the command-line options.", e);
System.exit(STARTUP_FAILURE_RETURN_CODE);
return;
}
Configuration dynamicProperties = BootstrapTools.parseDynamicProperties(cmd);
Configuration configuration = MesosEntrypointUtils.loadConfiguration(dynamicProperties, LOG);
MesosJobClusterEntrypoint clusterEntrypoint = new MesosJobClusterEntrypoint(configuration, dynamicProperties);
ClusterEntrypoint.runClusterEntrypoint(clusterEntrypoint);
}
示例11
public static void main(String[] args) {
try {
// startup checks and logging
EnvironmentInformation.logEnvironmentInfo(LOG, "ZooKeeper Quorum Peer", args);
final ParameterTool params = ParameterTool.fromArgs(args);
final String zkConfigFile = params.getRequired("zkConfigFile");
final int peerId = params.getInt("peerId");
// Run quorum peer
runFlinkZkQuorumPeer(zkConfigFile, peerId);
}
catch (Throwable t) {
LOG.error("Error running ZooKeeper quorum peer: " + t.getMessage(), t);
System.exit(-1);
}
}
示例12
public static DashboardConfiguration from(long refreshInterval, ZonedDateTime zonedDateTime) {
final String flinkVersion = EnvironmentInformation.getVersion();
final EnvironmentInformation.RevisionInformation revision = EnvironmentInformation.getRevisionInformation();
final String flinkRevision;
if (revision != null) {
flinkRevision = revision.commitId + " @ " + revision.commitDate;
} else {
flinkRevision = "unknown revision";
}
return new DashboardConfiguration(
refreshInterval,
zonedDateTime.getZone().getDisplayName(TextStyle.FULL, Locale.getDefault()),
// convert zone date time into offset in order to not do the day light saving adaptions wrt the offset
zonedDateTime.toOffsetDateTime().getOffset().getTotalSeconds() * 1000,
flinkVersion,
flinkRevision);
}
示例13
public static void main(String[] args) {
// startup checks and logging
EnvironmentInformation.logEnvironmentInfo(LOG, StandaloneSessionClusterEntrypoint.class.getSimpleName(), args);
SignalHandler.register(LOG);
JvmShutdownSafeguard.installAsShutdownHook(LOG);
EntrypointClusterConfiguration entrypointClusterConfiguration = null;
final CommandLineParser<EntrypointClusterConfiguration> commandLineParser = new CommandLineParser<>(new EntrypointClusterConfigurationParserFactory());
try {
entrypointClusterConfiguration = commandLineParser.parse(args);
} catch (FlinkParseException e) {
LOG.error("Could not parse command line arguments {}.", args, e);
commandLineParser.printHelp(StandaloneSessionClusterEntrypoint.class.getSimpleName());
System.exit(1);
}
Configuration configuration = loadConfiguration(entrypointClusterConfiguration);
StandaloneSessionClusterEntrypoint entrypoint = new StandaloneSessionClusterEntrypoint(configuration);
ClusterEntrypoint.runClusterEntrypoint(entrypoint);
}
示例14
/**
* Creates an AmazonDynamoDBStreamsAdapterClient.
* Uses it as the internal client interacting with the DynamoDB streams.
*
* @param configProps configuration properties
* @return an AWS DynamoDB streams adapter client
*/
@Override
protected AmazonKinesis createKinesisClient(Properties configProps) {
ClientConfiguration awsClientConfig = new ClientConfigurationFactory().getConfig();
setAwsClientConfigProperties(awsClientConfig, configProps);
AWSCredentialsProvider credentials = getCredentialsProvider(configProps);
awsClientConfig.setUserAgentPrefix(
String.format(
USER_AGENT_FORMAT,
EnvironmentInformation.getVersion(),
EnvironmentInformation.getRevisionInformation().commitId));
AmazonDynamoDBStreamsAdapterClient adapterClient =
new AmazonDynamoDBStreamsAdapterClient(credentials, awsClientConfig);
if (configProps.containsKey(AWS_ENDPOINT)) {
adapterClient.setEndpoint(configProps.getProperty(AWS_ENDPOINT));
} else {
adapterClient.setRegion(Region.getRegion(
Regions.fromName(configProps.getProperty(AWS_REGION))));
}
return adapterClient;
}
示例15
/**
* Creates an Amazon Kinesis Client.
* @param configProps configuration properties containing the access key, secret key, and region
* @param awsClientConfig preconfigured AWS SDK client configuration
* @return a new Amazon Kinesis Client
*/
public static AmazonKinesis createKinesisClient(Properties configProps, ClientConfiguration awsClientConfig) {
// set a Flink-specific user agent
awsClientConfig.setUserAgentPrefix(String.format(USER_AGENT_FORMAT,
EnvironmentInformation.getVersion(),
EnvironmentInformation.getRevisionInformation().commitId));
// utilize automatic refreshment of credentials by directly passing the AWSCredentialsProvider
AmazonKinesisClientBuilder builder = AmazonKinesisClientBuilder.standard()
.withCredentials(AWSUtil.getCredentialsProvider(configProps))
.withClientConfiguration(awsClientConfig);
if (configProps.containsKey(AWSConfigConstants.AWS_ENDPOINT)) {
// If an endpoint is specified, we give preference to using an endpoint and use the region property to
// sign the request.
builder.withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(
configProps.getProperty(AWSConfigConstants.AWS_ENDPOINT),
configProps.getProperty(AWSConfigConstants.AWS_REGION)));
} else {
builder.withRegion(Regions.fromName(configProps.getProperty(AWSConfigConstants.AWS_REGION)));
}
return builder.build();
}
示例16
public static void main(String[] args) {
// startup checks and logging
EnvironmentInformation.logEnvironmentInfo(LOG, MesosSessionClusterEntrypoint.class.getSimpleName(), args);
SignalHandler.register(LOG);
JvmShutdownSafeguard.installAsShutdownHook(LOG);
// load configuration incl. dynamic properties
CommandLineParser parser = new PosixParser();
CommandLine cmd;
try {
cmd = parser.parse(ALL_OPTIONS, args);
}
catch (Exception e){
LOG.error("Could not parse the command-line options.", e);
System.exit(STARTUP_FAILURE_RETURN_CODE);
return;
}
Configuration dynamicProperties = BootstrapTools.parseDynamicProperties(cmd);
Configuration configuration = MesosUtils.loadConfiguration(dynamicProperties, LOG);
MesosSessionClusterEntrypoint clusterEntrypoint = new MesosSessionClusterEntrypoint(configuration);
ClusterEntrypoint.runClusterEntrypoint(clusterEntrypoint);
}
示例17
public static void main(String[] args) {
// startup checks and logging
EnvironmentInformation.logEnvironmentInfo(LOG, MesosJobClusterEntrypoint.class.getSimpleName(), args);
SignalHandler.register(LOG);
JvmShutdownSafeguard.installAsShutdownHook(LOG);
// load configuration incl. dynamic properties
CommandLineParser parser = new PosixParser();
CommandLine cmd;
try {
cmd = parser.parse(ALL_OPTIONS, args);
}
catch (Exception e){
LOG.error("Could not parse the command-line options.", e);
System.exit(STARTUP_FAILURE_RETURN_CODE);
return;
}
Configuration dynamicProperties = BootstrapTools.parseDynamicProperties(cmd);
Configuration configuration = MesosUtils.loadConfiguration(dynamicProperties, LOG);
MesosJobClusterEntrypoint clusterEntrypoint = new MesosJobClusterEntrypoint(configuration);
ClusterEntrypoint.runClusterEntrypoint(clusterEntrypoint);
}
示例18
public static void main(String[] args) {
// startup checks and logging
EnvironmentInformation.logEnvironmentInfo(LOG, YarnSessionClusterEntrypoint.class.getSimpleName(), args);
SignalHandler.register(LOG);
JvmShutdownSafeguard.installAsShutdownHook(LOG);
Map<String, String> env = System.getenv();
final String workingDirectory = env.get(ApplicationConstants.Environment.PWD.key());
Preconditions.checkArgument(
workingDirectory != null,
"Working directory variable (%s) not set",
ApplicationConstants.Environment.PWD.key());
try {
YarnEntrypointUtils.logYarnEnvironmentInformation(env, LOG);
} catch (IOException e) {
LOG.warn("Could not log YARN environment information.", e);
}
Configuration configuration = YarnEntrypointUtils.loadConfiguration(workingDirectory, env);
YarnSessionClusterEntrypoint yarnSessionClusterEntrypoint = new YarnSessionClusterEntrypoint(configuration);
ClusterEntrypoint.runClusterEntrypoint(yarnSessionClusterEntrypoint);
}
示例19
public static void main(String[] args) {
// startup checks and logging
EnvironmentInformation.logEnvironmentInfo(LOG, YarnJobClusterEntrypoint.class.getSimpleName(), args);
SignalHandler.register(LOG);
JvmShutdownSafeguard.installAsShutdownHook(LOG);
Map<String, String> env = System.getenv();
final String workingDirectory = env.get(ApplicationConstants.Environment.PWD.key());
Preconditions.checkArgument(
workingDirectory != null,
"Working directory variable (%s) not set",
ApplicationConstants.Environment.PWD.key());
try {
YarnEntrypointUtils.logYarnEnvironmentInformation(env, LOG);
} catch (IOException e) {
LOG.warn("Could not log YARN environment information.", e);
}
Configuration configuration = YarnEntrypointUtils.loadConfiguration(workingDirectory, env);
YarnJobClusterEntrypoint yarnJobClusterEntrypoint = new YarnJobClusterEntrypoint(configuration);
ClusterEntrypoint.runClusterEntrypoint(yarnJobClusterEntrypoint);
}
示例20
public static void main(String[] args) throws Exception {
// startup checks and logging
EnvironmentInformation.logEnvironmentInfo(LOG, "TaskManager", args);
SignalHandler.register(LOG);
JvmShutdownSafeguard.installAsShutdownHook(LOG);
long maxOpenFileHandles = EnvironmentInformation.getOpenFileHandlesLimit();
if (maxOpenFileHandles != -1L) {
LOG.info("Maximum number of open file descriptors is {}.", maxOpenFileHandles);
} else {
LOG.info("Cannot determine the maximum number of open file descriptors");
}
runTaskManagerSecurely(args);
}
示例21
public static void main(String[] args) {
try {
// startup checks and logging
EnvironmentInformation.logEnvironmentInfo(LOG, "ZooKeeper Quorum Peer", args);
final ParameterTool params = ParameterTool.fromArgs(args);
final String zkConfigFile = params.getRequired("zkConfigFile");
final int peerId = params.getInt("peerId");
// Run quorum peer
runFlinkZkQuorumPeer(zkConfigFile, peerId);
}
catch (Throwable t) {
LOG.error("Error running ZooKeeper quorum peer: " + t.getMessage(), t);
System.exit(-1);
}
}
示例22
public static DashboardConfiguration from(long refreshInterval, ZonedDateTime zonedDateTime, boolean webSubmitEnabled) {
final String flinkVersion = EnvironmentInformation.getVersion();
final EnvironmentInformation.RevisionInformation revision = EnvironmentInformation.getRevisionInformation();
final String flinkRevision;
if (revision != null) {
flinkRevision = revision.commitId + " @ " + revision.commitDate;
} else {
flinkRevision = "unknown revision";
}
return new DashboardConfiguration(
refreshInterval,
zonedDateTime.getZone().getDisplayName(TextStyle.FULL, Locale.getDefault()),
// convert zone date time into offset in order to not do the day light saving adaptions wrt the offset
zonedDateTime.toOffsetDateTime().getOffset().getTotalSeconds() * 1000,
flinkVersion,
flinkRevision,
new Features(webSubmitEnabled));
}
示例23
public static void main(String[] args) {
// startup checks and logging
EnvironmentInformation.logEnvironmentInfo(LOG, StandaloneSessionClusterEntrypoint.class.getSimpleName(), args);
SignalHandler.register(LOG);
JvmShutdownSafeguard.installAsShutdownHook(LOG);
EntrypointClusterConfiguration entrypointClusterConfiguration = null;
final CommandLineParser<EntrypointClusterConfiguration> commandLineParser = new CommandLineParser<>(new EntrypointClusterConfigurationParserFactory());
try {
entrypointClusterConfiguration = commandLineParser.parse(args);
} catch (FlinkParseException e) {
LOG.error("Could not parse command line arguments {}.", args, e);
commandLineParser.printHelp(StandaloneSessionClusterEntrypoint.class.getSimpleName());
System.exit(1);
}
Configuration configuration = loadConfiguration(entrypointClusterConfiguration);
StandaloneSessionClusterEntrypoint entrypoint = new StandaloneSessionClusterEntrypoint(configuration);
ClusterEntrypoint.runClusterEntrypoint(entrypoint);
}
示例24
public static void main(String[] args) {
// startup checks and logging
EnvironmentInformation.logEnvironmentInfo(LOG, StandaloneJobClusterEntryPoint.class.getSimpleName(), args);
SignalHandler.register(LOG);
JvmShutdownSafeguard.installAsShutdownHook(LOG);
final CommandLineParser<StandaloneJobClusterConfiguration> commandLineParser = new CommandLineParser<>(new StandaloneJobClusterConfigurationParserFactory());
StandaloneJobClusterConfiguration clusterConfiguration = null;
try {
clusterConfiguration = commandLineParser.parse(args);
} catch (Exception e) {
LOG.error("Could not parse command line arguments {}.", args, e);
commandLineParser.printHelp(StandaloneJobClusterEntryPoint.class.getSimpleName());
System.exit(1);
}
Configuration configuration = loadConfiguration(clusterConfiguration);
configuration.setString(ClusterEntrypoint.EXECUTION_MODE, ExecutionMode.DETACHED.toString());
StandaloneJobClusterEntryPoint entrypoint = new StandaloneJobClusterEntryPoint(
configuration,
resolveJobIdForCluster(Optional.ofNullable(clusterConfiguration.getJobId()), configuration),
clusterConfiguration.getSavepointRestoreSettings(),
clusterConfiguration.getArgs(),
clusterConfiguration.getJobClassName());
ClusterEntrypoint.runClusterEntrypoint(entrypoint);
}
示例25
/**
* The entry point for the YARN task executor runner.
*
* @param args The command line arguments.
*/
public static void main(String[] args) {
EnvironmentInformation.logEnvironmentInfo(LOG, "YARN TaskExecutor runner", args);
SignalHandler.register(LOG);
JvmShutdownSafeguard.installAsShutdownHook(LOG);
run(args);
}
示例26
public static void main(String[] args) {
// startup checks and logging
EnvironmentInformation.logEnvironmentInfo(LOG, YarnSessionClusterEntrypoint.class.getSimpleName(), args);
SignalHandler.register(LOG);
JvmShutdownSafeguard.installAsShutdownHook(LOG);
Map<String, String> env = System.getenv();
final String workingDirectory = env.get(ApplicationConstants.Environment.PWD.key());
Preconditions.checkArgument(
workingDirectory != null,
"Working directory variable (%s) not set",
ApplicationConstants.Environment.PWD.key());
try {
YarnEntrypointUtils.logYarnEnvironmentInformation(env, LOG);
} catch (IOException e) {
LOG.warn("Could not log YARN environment information.", e);
}
Configuration configuration = YarnEntrypointUtils.loadConfiguration(workingDirectory, env, LOG);
YarnSessionClusterEntrypoint yarnSessionClusterEntrypoint = new YarnSessionClusterEntrypoint(
configuration,
workingDirectory);
ClusterEntrypoint.runClusterEntrypoint(yarnSessionClusterEntrypoint);
}
示例27
public static void main(String[] args) {
// startup checks and logging
EnvironmentInformation.logEnvironmentInfo(LOG, YarnJobClusterEntrypoint.class.getSimpleName(), args);
SignalHandler.register(LOG);
JvmShutdownSafeguard.installAsShutdownHook(LOG);
Map<String, String> env = System.getenv();
final String workingDirectory = env.get(ApplicationConstants.Environment.PWD.key());
Preconditions.checkArgument(
workingDirectory != null,
"Working directory variable (%s) not set",
ApplicationConstants.Environment.PWD.key());
try {
YarnEntrypointUtils.logYarnEnvironmentInformation(env, LOG);
} catch (IOException e) {
LOG.warn("Could not log YARN environment information.", e);
}
Configuration configuration = YarnEntrypointUtils.loadConfiguration(workingDirectory, env, LOG);
YarnJobClusterEntrypoint yarnJobClusterEntrypoint = new YarnJobClusterEntrypoint(
configuration,
workingDirectory);
ClusterEntrypoint.runClusterEntrypoint(yarnJobClusterEntrypoint);
}
示例28
public static void main(String[] args) throws Exception {
// startup checks and logging
EnvironmentInformation.logEnvironmentInfo(LOG, "TaskManager", args);
SignalHandler.register(LOG);
JvmShutdownSafeguard.installAsShutdownHook(LOG);
long maxOpenFileHandles = EnvironmentInformation.getOpenFileHandlesLimit();
if (maxOpenFileHandles != -1L) {
LOG.info("Maximum number of open file descriptors is {}.", maxOpenFileHandles);
} else {
LOG.info("Cannot determine the maximum number of open file descriptors");
}
final Configuration configuration = loadConfiguration(args);
try {
FileSystem.initialize(configuration);
} catch (IOException e) {
throw new IOException("Error while setting the default " +
"filesystem scheme from configuration.", e);
}
SecurityUtils.install(new SecurityConfiguration(configuration));
try {
SecurityUtils.getInstalledContext().runSecured(new Callable<Void>() {
@Override
public Void call() throws Exception {
runTaskManager(configuration, ResourceID.generate());
return null;
}
});
} catch (Throwable t) {
final Throwable strippedThrowable = ExceptionUtils.stripException(t, UndeclaredThrowableException.class);
LOG.error("TaskManager initialization failed.", strippedThrowable);
System.exit(STARTUP_FAILURE_RETURN_CODE);
}
}
示例29
/**
* Submits the job based on the arguments.
*/
public static void main(final String[] args) {
EnvironmentInformation.logEnvironmentInfo(LOG, "Command Line Client", args);
// 1. find the configuration directory
final String configurationDirectory = getConfigurationDirectoryFromEnv();
// 2. load the global configuration
final Configuration configuration = GlobalConfiguration.loadConfiguration(configurationDirectory);
// 3. load the custom command lines
final List<CustomCommandLine<?>> customCommandLines = loadCustomCommandLines(
configuration,
configurationDirectory);
try {
final CliFrontend cli = new CliFrontend(
configuration,
customCommandLines);
SecurityUtils.install(new SecurityConfiguration(cli.configuration));
int retCode = SecurityUtils.getInstalledContext()
.runSecured(() -> cli.parseParameters(args));
System.exit(retCode);
}
catch (Throwable t) {
final Throwable strippedThrowable = ExceptionUtils.stripException(t, UndeclaredThrowableException.class);
LOG.error("Fatal error while running command line interface.", strippedThrowable);
strippedThrowable.printStackTrace();
System.exit(31);
}
}
示例30
@SuppressWarnings("WeakerAccess")
public SerializingLongReceiver(InputGate inputGate, int expectedRepetitionsOfExpectedRecord) {
super(expectedRepetitionsOfExpectedRecord);
this.reader = new MutableRecordReader<>(
inputGate,
new String[]{
EnvironmentInformation.getTemporaryFileDirectory()
});
}