org.apache.flink.api.common.time.Time.seconds()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(9.0k)|赞(0)|评价(0)|浏览(150)

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

Time.seconds介绍

[英]Creates a new Time that represents the given number of seconds.
[中]创建表示给定秒数的新时间。

代码示例

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

@Override
public void shutdown() {
  ExecutorUtils.gracefulShutdown(restClusterClientConfiguration.getRetryDelay(), TimeUnit.MILLISECONDS, retryExecutorService);
  this.restClient.shutdown(Time.seconds(5));
  ExecutorUtils.gracefulShutdown(5, TimeUnit.SECONDS, this.executorService);
  try {
    webMonitorRetrievalService.stop();
  } catch (Exception e) {
    log.error("An error occurred during stopping the webMonitorRetrievalService", e);
  }
  try {
    dispatcherRetrievalService.stop();
  } catch (Exception e) {
    log.error("An error occurred during stopping the dispatcherLeaderRetriever", e);
  }
  try {
    // we only call this for legacy reasons to shutdown components that are started in the ClusterClient constructor
    super.shutdown();
  } catch (Exception e) {
    log.error("An error occurred during the client shutdown.", e);
  }
}

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

@AfterClass
public static void tearDown() throws Exception {
  try {
    YarnTestBase.teardown();
  } finally {
    if (restClient != null) {
      restClient.shutdown(Time.seconds(5));
    }
    if (restClientExecutor != null) {
      restClientExecutor.shutdownNow();
    }
  }
}

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

@Before
public void setUp() throws Exception {
  MockitoAnnotations.initMocks(this);
  jarDir = temporaryFolder.newFolder().toPath();
  jarUploadHandler = new JarUploadHandler(
    () -> CompletableFuture.completedFuture(mockDispatcherGateway),
    Time.seconds(10),
    Collections.emptyMap(),
    JarUploadHeaders.getInstance(),
    jarDir,
    Executors.directExecutor());
}

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

static void init() throws Exception {
  jarDir = TMP.newFolder().toPath();
  // properties are set property by surefire plugin
  final String parameterProgramJarName = System.getProperty("parameterJarName") + ".jar";
  final String parameterProgramWithoutManifestJarName = System.getProperty("parameterJarWithoutManifestName") + ".jar";
  final Path jarLocation = Paths.get(System.getProperty("targetDir"));
  jarWithManifest = Files.copy(
    jarLocation.resolve(parameterProgramJarName),
    jarDir.resolve("program-with-manifest.jar"));
  jarWithoutManifest = Files.copy(
    jarLocation.resolve(parameterProgramWithoutManifestJarName),
    jarDir.resolve("program-without-manifest.jar"));
  restfulGateway = new TestingDispatcherGateway.Builder()
    .setBlobServerPort(BLOB_SERVER_RESOURCE.getBlobServerPort())
    .setSubmitFunction(jobGraph -> {
      LAST_SUBMITTED_JOB_GRAPH_REFERENCE.set(jobGraph);
      return CompletableFuture.completedFuture(Acknowledge.get());
    })
    .build();
  gatewayRetriever = () -> CompletableFuture.completedFuture(restfulGateway);
  localAddressFuture = CompletableFuture.completedFuture("shazam://localhost:12345");
  timeout = Time.seconds(10);
  responseHeaders = Collections.emptyMap();
  executor = TestingUtils.defaultExecutor();
}

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

/**
   * Tests dynamically loading of handlers such as {@link JarUploadHandler}.
   */
  @Test
  public void testLoadWebSubmissionExtension() throws Exception {
    final Configuration configuration = new Configuration();
    configuration.setString(JobManagerOptions.ADDRESS, "localhost");
    final WebMonitorExtension webMonitorExtension = WebMonitorUtils.loadWebSubmissionExtension(
      CompletableFuture::new,
      Time.seconds(10),
      Collections.emptyMap(),
      CompletableFuture.completedFuture("localhost:12345"),
      Paths.get("/tmp"),
      Executors.directExecutor(),
      configuration);

    assertThat(webMonitorExtension, is(not(nullValue())));
  }
}

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

@Before
public void setUp() throws Exception {
  jarDir = temporaryFolder.newFolder().toPath();
  restfulGateway = TestingRestfulGateway.newBuilder().build();
  jarDeleteHandler = new JarDeleteHandler(
    () -> CompletableFuture.completedFuture(restfulGateway),
    Time.seconds(10),
    Collections.emptyMap(),
    new JarDeleteHeaders(),
    jarDir,
    Executors.directExecutor()
  );
  Files.createFile(jarDir.resolve(TEST_JAR_NAME));
}

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

@BeforeClass
public static void setup() throws Exception {
  init();
  final GatewayRetriever<TestingDispatcherGateway> gatewayRetriever = () -> CompletableFuture.completedFuture(restfulGateway);
  final Time timeout = Time.seconds(10);
  final Map<String, String> responseHeaders = Collections.emptyMap();
  final Executor executor = TestingUtils.defaultExecutor();
  handler = new JarRunHandler(
    gatewayRetriever,
    timeout,
    responseHeaders,
    JarRunHeaders.getInstance(),
    jarDir,
    new Configuration(),
    executor);
}

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

/**
 * Helper method to wait until the {@link Dispatcher} has set its fencing token.
 *
 * @param rpcService to use to connect to the dispatcher
 * @param haServices high availability services to connect to the dispatcher
 * @return {@link DispatcherGateway}
 * @throws Exception if something goes wrong
 */
static DispatcherGateway retrieveDispatcherGateway(RpcService rpcService, HighAvailabilityServices haServices) throws Exception {
  final LeaderConnectionInfo leaderConnectionInfo = LeaderRetrievalUtils.retrieveLeaderConnectionInfo(haServices.getDispatcherLeaderRetriever(), Time.seconds(10L));
  return rpcService.connect(
    leaderConnectionInfo.getAddress(),
    DispatcherId.fromUuid(leaderConnectionInfo.getLeaderSessionID()),
    DispatcherGateway.class).get();
}

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

MockResourceManagerRuntimeServices() throws Exception {
  scheduledExecutor = mock(ScheduledExecutor.class);
  highAvailabilityServices = new TestingHighAvailabilityServices();
  rmLeaderElectionService = new TestingLeaderElectionService();
  highAvailabilityServices.setResourceManagerLeaderElectionService(rmLeaderElectionService);
  heartbeatServices = new TestingHeartbeatServices(5L, 5L, scheduledExecutor);
  metricRegistry = NoOpMetricRegistry.INSTANCE;
  slotManager = new SlotManager(
      new ScheduledExecutorServiceAdapter(new DirectScheduledExecutorService()),
      Time.seconds(10), Time.seconds(10), Time.minutes(1));
  jobLeaderIdService = new JobLeaderIdService(
      highAvailabilityServices,
      rpcService.getScheduledExecutor(),
      Time.minutes(5L));
}

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

dataPort,
  hardwareDescription,
  Time.seconds(10L))
.thenCompose(
  (RegistrationResponse response) -> {
      success.getRegistrationId(),
      slotReport,
      Time.seconds(10L));
  })
.handleAsync(

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

RpcUtils.terminateRpcService(rpcService, Time.seconds(100L));

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

Time.seconds(10),
(throwable) -> true,
TestingUtils.defaultScheduledExecutor()

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

JarHandlers(final Path jarDir, final TestingDispatcherGateway restfulGateway) {
  final GatewayRetriever<TestingDispatcherGateway> gatewayRetriever = () -> CompletableFuture.completedFuture(restfulGateway);
  final Time timeout = Time.seconds(10);
  final Map<String, String> responseHeaders = Collections.emptyMap();
  final Executor executor = TestingUtils.defaultExecutor();

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

@Test
public void testDispatcherProcessFailure() throws Exception {
  final Time timeout = Time.seconds(30L);
  final File zookeeperStoragePath = temporaryFolder.newFolder();

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

final Time timeout = Time.seconds(10L);
final CompletableFuture<RestfulGateway> gatewayFuture = new CompletableFuture<>();
final GatewayRetriever<RestfulGateway> gatewayRetriever = () -> gatewayFuture;

代码示例来源:origin: org.apache.flink/flink-runtime_2.11

/**
 * Creates a new Flink mini cluster based on the given configuration.
 *
 * @param miniClusterConfiguration The configuration for the mini cluster
 */
public MiniCluster(MiniClusterConfiguration miniClusterConfiguration) {
  this.miniClusterConfiguration = checkNotNull(miniClusterConfiguration, "config may not be null");
  this.rpcTimeout = Time.seconds(10L);
  this.terminationFuture = CompletableFuture.completedFuture(null);
  running = false;
}

代码示例来源:origin: org.apache.flink/flink-runtime

/**
 * Creates a new Flink mini cluster based on the given configuration.
 *
 * @param miniClusterConfiguration The configuration for the mini cluster
 */
public MiniCluster(MiniClusterConfiguration miniClusterConfiguration) {
  this.miniClusterConfiguration = checkNotNull(miniClusterConfiguration, "config may not be null");
  this.rpcTimeout = Time.seconds(10L);
  this.terminationFuture = CompletableFuture.completedFuture(null);
  running = false;
}

代码示例来源:origin: com.alibaba.blink/flink-runtime

/**
 * Creates a new Flink mini cluster based on the given configuration.
 *
 * @param miniClusterConfiguration The configuration for the mini cluster
 */
public MiniCluster(MiniClusterConfiguration miniClusterConfiguration) {
  this.miniClusterConfiguration = checkNotNull(miniClusterConfiguration, "config may not be null");
  this.rpcTimeout = Time.seconds(10L);
  this.terminationFuture = CompletableFuture.completedFuture(null);
  running = false;
}

代码示例来源:origin: org.apache.flink/flink-runtime_2.11

@Override
public CompletableFuture<Void> closeAsync() {
  return shutdownInternally(Time.seconds(10L));
}

代码示例来源:origin: com.alibaba.blink/flink-runtime

@Override
public void cancel(JobID jobId) throws Exception {
  final DispatcherGateway dispatcherGateway;
  try {
    dispatcherGateway = getDispatcherGateway();
  } catch (LeaderRetrievalException | InterruptedException e) {
    ExceptionUtils.checkInterrupted(e);
    throw new Exception(e);
  }
  dispatcherGateway.cancelJob(jobId, Time.seconds(10));
}

相关文章