use of org.apache.flink.util.AbstractID in project flink by apache.
the class TaskManagerGroupTest method testCloseClosesAll.
@Test
public void testCloseClosesAll() throws IOException {
MetricRegistry registry = new MetricRegistry(MetricRegistryConfiguration.defaultMetricRegistryConfiguration());
final TaskManagerMetricGroup group = new TaskManagerMetricGroup(registry, "localhost", new AbstractID().toString());
final JobID jid1 = new JobID();
final JobID jid2 = new JobID();
final String jobName1 = "testjob";
final String jobName2 = "anotherJob";
final JobVertexID vertex11 = new JobVertexID();
final JobVertexID vertex12 = new JobVertexID();
final JobVertexID vertex21 = new JobVertexID();
final ExecutionAttemptID execution11 = new ExecutionAttemptID();
final ExecutionAttemptID execution12 = new ExecutionAttemptID();
final ExecutionAttemptID execution21 = new ExecutionAttemptID();
TaskMetricGroup tmGroup11 = group.addTaskForJob(jid1, jobName1, vertex11, execution11, "test", 17, 0);
TaskMetricGroup tmGroup12 = group.addTaskForJob(jid1, jobName1, vertex12, execution12, "test", 13, 1);
TaskMetricGroup tmGroup21 = group.addTaskForJob(jid2, jobName2, vertex21, execution21, "test", 7, 1);
group.close();
assertTrue(tmGroup11.isClosed());
assertTrue(tmGroup12.isClosed());
assertTrue(tmGroup21.isClosed());
registry.shutdown();
}
use of org.apache.flink.util.AbstractID in project flink by apache.
the class TaskMetricGroupTest method testGenerateScopeWilcard.
@Test
public void testGenerateScopeWilcard() {
Configuration cfg = new Configuration();
cfg.setString(ConfigConstants.METRICS_SCOPE_NAMING_TASK, "*.<task_attempt_id>.<subtask_index>");
MetricRegistry registry = new MetricRegistry(MetricRegistryConfiguration.fromConfiguration(cfg));
AbstractID executionId = new AbstractID();
TaskManagerMetricGroup tmGroup = new TaskManagerMetricGroup(registry, "theHostName", "test-tm-id");
TaskManagerJobMetricGroup jmGroup = new TaskManagerJobMetricGroup(registry, tmGroup, new JobID(), "myJobName");
TaskMetricGroup taskGroup = new TaskMetricGroup(registry, jmGroup, new AbstractID(), executionId, "aTaskName", 13, 1);
assertArrayEquals(new String[] { "theHostName", "taskmanager", "test-tm-id", "myJobName", executionId.toString(), "13" }, taskGroup.getScopeComponents());
assertEquals("theHostName.taskmanager.test-tm-id.myJobName." + executionId + ".13.name", taskGroup.getMetricIdentifier("name"));
registry.shutdown();
}
use of org.apache.flink.util.AbstractID in project flink by apache.
the class TaskMetricGroupTest method testCreateQueryServiceMetricInfo.
@Test
public void testCreateQueryServiceMetricInfo() {
JobID jid = new JobID();
AbstractID vid = new AbstractID();
AbstractID eid = new AbstractID();
MetricRegistry registry = new MetricRegistry(MetricRegistryConfiguration.defaultMetricRegistryConfiguration());
TaskManagerMetricGroup tm = new TaskManagerMetricGroup(registry, "host", "id");
TaskManagerJobMetricGroup job = new TaskManagerJobMetricGroup(registry, tm, jid, "jobname");
TaskMetricGroup task = new TaskMetricGroup(registry, job, vid, eid, "taskName", 4, 5);
QueryScopeInfo.TaskQueryScopeInfo info = task.createQueryServiceMetricInfo(new DummyCharacterFilter());
assertEquals("", info.scope);
assertEquals(jid.toString(), info.jobID);
assertEquals(vid.toString(), info.vertexID);
assertEquals(4, info.subtaskIndex);
}
use of org.apache.flink.util.AbstractID in project flink by apache.
the class MetricGroupTest method testCreateQueryServiceMetricInfo.
@Test
public void testCreateQueryServiceMetricInfo() {
JobID jid = new JobID();
AbstractID vid = new AbstractID();
AbstractID eid = new AbstractID();
MetricRegistry registry = new MetricRegistry(defaultMetricRegistryConfiguration);
TaskManagerMetricGroup tm = new TaskManagerMetricGroup(registry, "host", "id");
TaskManagerJobMetricGroup job = new TaskManagerJobMetricGroup(registry, tm, jid, "jobname");
TaskMetricGroup task = new TaskMetricGroup(registry, job, vid, eid, "taskName", 4, 5);
GenericMetricGroup userGroup1 = new GenericMetricGroup(registry, task, "hello");
GenericMetricGroup userGroup2 = new GenericMetricGroup(registry, userGroup1, "world");
QueryScopeInfo.TaskQueryScopeInfo info1 = (QueryScopeInfo.TaskQueryScopeInfo) userGroup1.createQueryServiceMetricInfo(new DummyCharacterFilter());
assertEquals("hello", info1.scope);
assertEquals(jid.toString(), info1.jobID);
assertEquals(vid.toString(), info1.vertexID);
assertEquals(4, info1.subtaskIndex);
QueryScopeInfo.TaskQueryScopeInfo info2 = (QueryScopeInfo.TaskQueryScopeInfo) userGroup2.createQueryServiceMetricInfo(new DummyCharacterFilter());
assertEquals("hello.world", info2.scope);
assertEquals(jid.toString(), info2.jobID);
assertEquals(vid.toString(), info2.vertexID);
assertEquals(4, info2.subtaskIndex);
}
use of org.apache.flink.util.AbstractID in project flink by apache.
the class OperatorGroupTest method testCreateQueryServiceMetricInfo.
@Test
public void testCreateQueryServiceMetricInfo() {
JobID jid = new JobID();
AbstractID vid = new AbstractID();
AbstractID eid = new AbstractID();
MetricRegistry registry = new MetricRegistry(MetricRegistryConfiguration.defaultMetricRegistryConfiguration());
TaskManagerMetricGroup tm = new TaskManagerMetricGroup(registry, "host", "id");
TaskManagerJobMetricGroup job = new TaskManagerJobMetricGroup(registry, tm, jid, "jobname");
TaskMetricGroup task = new TaskMetricGroup(registry, job, vid, eid, "taskName", 4, 5);
OperatorMetricGroup operator = new OperatorMetricGroup(registry, task, "operator");
QueryScopeInfo.OperatorQueryScopeInfo info = operator.createQueryServiceMetricInfo(new DummyCharacterFilter());
assertEquals("", info.scope);
assertEquals(jid.toString(), info.jobID);
assertEquals(vid.toString(), info.vertexID);
assertEquals(4, info.subtaskIndex);
assertEquals("operator", info.operatorName);
}
Aggregations