Search in sources :

Example 1 with ConfigurationException

use of org.apache.flink.runtime.resourcemanager.exceptions.ConfigurationException in project flink by apache.

the class ResourceManagerConfiguration method fromConfiguration.

// --------------------------------------------------------------------------
// Static factory methods
// --------------------------------------------------------------------------
public static ResourceManagerConfiguration fromConfiguration(Configuration configuration) throws ConfigurationException {
    final String strTimeout = configuration.getString(AkkaOptions.AKKA_ASK_TIMEOUT);
    final Time timeout;
    try {
        timeout = Time.milliseconds(Duration.apply(strTimeout).toMillis());
    } catch (NumberFormatException e) {
        throw new ConfigurationException("Could not parse the resource manager's timeout " + "value " + AkkaOptions.AKKA_ASK_TIMEOUT + '.', e);
    }
    final String strHeartbeatInterval = configuration.getString(AkkaOptions.AKKA_WATCH_HEARTBEAT_INTERVAL);
    final Time heartbeatInterval;
    try {
        heartbeatInterval = Time.milliseconds(Duration.apply(strHeartbeatInterval).toMillis());
    } catch (NumberFormatException e) {
        throw new ConfigurationException("Could not parse the resource manager's heartbeat interval " + "value " + AkkaOptions.AKKA_WATCH_HEARTBEAT_INTERVAL + '.', e);
    }
    final String strJobTimeout = configuration.getString(ResourceManagerOptions.JOB_TIMEOUT);
    final Time jobTimeout;
    try {
        jobTimeout = Time.milliseconds(Duration.apply(strJobTimeout).toMillis());
    } catch (NumberFormatException e) {
        throw new ConfigurationException("Could not parse the resource manager's job timeout " + "value " + ResourceManagerOptions.JOB_TIMEOUT + '.', e);
    }
    return new ResourceManagerConfiguration(timeout, heartbeatInterval, jobTimeout);
}
Also used : ConfigurationException(org.apache.flink.runtime.resourcemanager.exceptions.ConfigurationException) Time(org.apache.flink.api.common.time.Time)

Aggregations

Time (org.apache.flink.api.common.time.Time)1 ConfigurationException (org.apache.flink.runtime.resourcemanager.exceptions.ConfigurationException)1