use of org.apache.flink.api.common.JobID in project flink by apache.
the class MiniClusterITCase method getSimpleJob.
private static JobGraph getSimpleJob() throws IOException {
JobVertex task = new JobVertex("Test task");
task.setParallelism(1);
task.setMaxParallelism(1);
task.setInvokableClass(NoOpInvokable.class);
JobGraph jg = new JobGraph(new JobID(), "Test Job", task);
jg.setAllowQueuedScheduling(true);
jg.setScheduleMode(ScheduleMode.EAGER);
ExecutionConfig executionConfig = new ExecutionConfig();
executionConfig.setRestartStrategy(RestartStrategies.fixedDelayRestart(Integer.MAX_VALUE, 1000));
jg.setExecutionConfig(executionConfig);
return jg;
}
use of org.apache.flink.api.common.JobID in project flink by apache.
the class JobManagerGroupTest method addAndRemoveJobs.
// ------------------------------------------------------------------------
// adding and removing jobs
// ------------------------------------------------------------------------
@Test
public void addAndRemoveJobs() {
MetricRegistry registry = new MetricRegistry(MetricRegistryConfiguration.defaultMetricRegistryConfiguration());
final JobManagerMetricGroup group = new JobManagerMetricGroup(registry, "localhost");
final JobID jid1 = new JobID();
final JobID jid2 = new JobID();
final String jobName1 = "testjob";
final String jobName2 = "anotherJob";
JobManagerJobMetricGroup jmJobGroup11 = group.addJob(new JobGraph(jid1, jobName1));
JobManagerJobMetricGroup jmJobGroup12 = group.addJob(new JobGraph(jid1, jobName1));
JobManagerJobMetricGroup jmJobGroup21 = group.addJob(new JobGraph(jid2, jobName2));
assertEquals(jmJobGroup11, jmJobGroup12);
assertEquals(2, group.numRegisteredJobMetricGroups());
group.removeJob(jid1);
assertTrue(jmJobGroup11.isClosed());
assertEquals(1, group.numRegisteredJobMetricGroups());
group.removeJob(jid2);
assertTrue(jmJobGroup21.isClosed());
assertEquals(0, group.numRegisteredJobMetricGroups());
registry.shutdown();
}
use of org.apache.flink.api.common.JobID in project flink by apache.
the class JobManagerGroupTest method testCloseClosesAll.
@Test
public void testCloseClosesAll() {
MetricRegistry registry = new MetricRegistry(MetricRegistryConfiguration.defaultMetricRegistryConfiguration());
final JobManagerMetricGroup group = new JobManagerMetricGroup(registry, "localhost");
final JobID jid1 = new JobID();
final JobID jid2 = new JobID();
final String jobName1 = "testjob";
final String jobName2 = "anotherJob";
JobManagerJobMetricGroup jmJobGroup11 = group.addJob(new JobGraph(jid1, jobName1));
JobManagerJobMetricGroup jmJobGroup21 = group.addJob(new JobGraph(jid2, jobName2));
group.close();
assertTrue(jmJobGroup11.isClosed());
assertTrue(jmJobGroup21.isClosed());
registry.shutdown();
}
use of org.apache.flink.api.common.JobID in project flink by apache.
the class JobManagerJobGroupTest method testGenerateScopeCustom.
@Test
public void testGenerateScopeCustom() {
Configuration cfg = new Configuration();
cfg.setString(ConfigConstants.METRICS_SCOPE_NAMING_JM, "abc");
cfg.setString(ConfigConstants.METRICS_SCOPE_NAMING_JM_JOB, "some-constant.<job_name>");
MetricRegistry registry = new MetricRegistry(MetricRegistryConfiguration.fromConfiguration(cfg));
JobID jid = new JobID();
JobManagerMetricGroup tmGroup = new JobManagerMetricGroup(registry, "theHostName");
JobMetricGroup jmGroup = new JobManagerJobMetricGroup(registry, tmGroup, jid, "myJobName");
assertArrayEquals(new String[] { "some-constant", "myJobName" }, jmGroup.getScopeComponents());
assertEquals("some-constant.myJobName.name", jmGroup.getMetricIdentifier("name"));
registry.shutdown();
}
use of org.apache.flink.api.common.JobID in project flink by apache.
the class JobManagerJobGroupTest method testCreateQueryServiceMetricInfo.
@Test
public void testCreateQueryServiceMetricInfo() {
JobID jid = new JobID();
MetricRegistry registry = new MetricRegistry(MetricRegistryConfiguration.defaultMetricRegistryConfiguration());
JobManagerMetricGroup jm = new JobManagerMetricGroup(registry, "host");
JobManagerJobMetricGroup jmj = new JobManagerJobMetricGroup(registry, jm, jid, "jobname");
QueryScopeInfo.JobQueryScopeInfo info = jmj.createQueryServiceMetricInfo(new DummyCharacterFilter());
assertEquals("", info.scope);
assertEquals(jid.toString(), info.jobID);
}
Aggregations