com.hazelcast.jet.Job.getName()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(80)

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

Job.getName介绍

[英]Returns the name of this job or null if no name was supplied.

Jobs can be named through JobConfig#setName(String) prior to submission.
[中]返回此作业的名称,如果未提供名称,则返回null。
作业可以在提交之前通过JobConfig#setName(字符串)命名。

代码示例

代码示例来源:origin: hazelcast/hazelcast-jet

private static String formatJob(Job job) {
  return "id=" + idToString(job.getId())
      + ", name=" + job.getName()
      + ", submissionTime=" + toLocalDateTime(job.getSubmissionTime());
}

代码示例来源:origin: hazelcast/hazelcast-jet-code-samples

System.out.println("Job '" + job.getName() + "' is submitted.");

代码示例来源:origin: hazelcast/hazelcast-jet

@Test
public void test_cancelJob_byJobName() {
  // Given
  Job job = newJob();
  // When
  run("cancel", job.getName());
  // Then
  assertJobStatusEventually(job, JobStatus.FAILED);
}

代码示例来源:origin: hazelcast/hazelcast-jet

@Test
public void test_suspendJob_byJobName() {
  // Given
  Job job = newJob();
  // When
  run("suspend", job.getName());
  // Then
  assertJobStatusEventually(job, JobStatus.SUSPENDED);
}

代码示例来源:origin: hazelcast/hazelcast-jet

@Test
public void test_saveSnapshot_byJobName() {
  // Given
  Job job = newJob();
  assertJobStatusEventually(job, JobStatus.RUNNING);
  // When
  run("save-snapshot", job.getName(), "my-snapshot");
  // Then
  JobStateSnapshot ss = jet.getJobStateSnapshot("my-snapshot");
  assertNotNull("no snapshot was found", ss);
  assertEquals(job.getName(), ss.jobName());
}

代码示例来源:origin: hazelcast/hazelcast-jet-code-samples

System.out.println("Tracked job: " + trackedJob1.getName() + ", status: " + trackedJob1.getStatus());

代码示例来源:origin: hazelcast/hazelcast-jet

@Test
public void test_saveSnapshotAndCancel_byJobName() {
  // Given
  Job job = newJob();
  assertJobStatusEventually(job, JobStatus.RUNNING);
  // When
  run("save-snapshot", "-C", job.getName(), "my-snapshot");
  // Then
  JobStateSnapshot ss = jet.getJobStateSnapshot("my-snapshot");
  assertNotNull("no snapshot was found", ss);
  assertEquals(job.getName(), ss.jobName());
  assertJobStatusEventually(job, JobStatus.FAILED);
}

代码示例来源:origin: hazelcast/hazelcast-jet

@Test
public void test_resumeJob_jobNotSuspended() {
  // Given
  Job job = newJob();
  assertJobStatusEventually(job, JobStatus.RUNNING);
  // When
  // Then
  exception.expectMessage("is not suspended");
  run("resume", job.getName());
}

代码示例来源:origin: hazelcast/hazelcast-jet

@Test
public void test_resumeJob_byJobName() {
  // Given
  Job job = newJob();
  assertJobStatusEventually(job, JobStatus.RUNNING);
  job.suspend();
  // When
  run("resume", job.getName());
  // Then
  assertJobStatusEventually(job, JobStatus.RUNNING);
}

代码示例来源:origin: hazelcast/hazelcast-jet

@Test
public void test_cancelJob_jobNotActive() {
  // Given
  Job job = newJob();
  job.cancel();
  assertJobStatusEventually(job, JobStatus.FAILED);
  // When
  // Then
  exception.expectMessage("is not active");
  run("cancel", job.getName());
}

代码示例来源:origin: hazelcast/hazelcast-jet

@Test
public void test_suspendJob_jobNotRunning() {
  // Given
  Job job = newJob();
  job.cancel();
  assertJobStatusEventually(job, JobStatus.FAILED);
  // When
  // Then
  exception.expectMessage("is not running");
  run("suspend", job.getName());
}

代码示例来源:origin: hazelcast/hazelcast-jet

@Test
public void test_restartJob_jobNotRunning() {
  // Given
  Job job = newJob();
  assertJobStatusEventually(job, JobStatus.RUNNING);
  job.suspend();
  assertJobStatusEventually(job, JobStatus.SUSPENDED);
  // When
  // Then
  exception.expectMessage("is not running");
  run("restart", job.getName());
}

代码示例来源:origin: hazelcast/hazelcast-jet

@Test
public void test_restartJob_byJobName() {
  // Given
  Job job = newJob();
  assertTrueEventually(() -> assertEquals(ITEM_COUNT, sinkList.size()));
  // When
  run("restart", job.getName());
  // Then
  // we expect the same items to be read again due to lack of snapshots
  assertTrueEventually(() -> assertEquals(ITEM_COUNT * 2, sinkList.size()));
}

代码示例来源:origin: hazelcast/hazelcast-jet

@Test
public void test_saveSnapshot_byJobId() {
  // Given
  Job job = newJob();
  assertJobStatusEventually(job, JobStatus.RUNNING);
  // When
  run("save-snapshot", job.getIdString(), "my-snapshot");
  // Then
  JobStateSnapshot ss = jet.getJobStateSnapshot("my-snapshot");
  assertNotNull("no snapshot was found", ss);
  assertEquals(job.getName(), ss.jobName());
}

代码示例来源:origin: hazelcast/hazelcast-jet

@Test
public void test_listJobs() {
  // Given
  Job job = newJob();
  // When
  run("jobs");
  // Then
  String actual = captureOut();
  assertContains(actual, job.getName());
  assertContains(actual, job.getIdString());
  assertContains(actual, job.getStatus().toString());
}

相关文章