Search in sources :

Example 46 with JobID

use of org.apache.flink.api.common.JobID in project flink by apache.

the class JobManagerJobGroupTest method testGenerateScopeDefault.

@Test
public void testGenerateScopeDefault() {
    MetricRegistry registry = new MetricRegistry(MetricRegistryConfiguration.defaultMetricRegistryConfiguration());
    JobManagerMetricGroup tmGroup = new JobManagerMetricGroup(registry, "theHostName");
    JobMetricGroup jmGroup = new JobManagerJobMetricGroup(registry, tmGroup, new JobID(), "myJobName");
    assertArrayEquals(new String[] { "theHostName", "jobmanager", "myJobName" }, jmGroup.getScopeComponents());
    assertEquals("theHostName.jobmanager.myJobName.name", jmGroup.getMetricIdentifier("name"));
    registry.shutdown();
}
Also used : MetricRegistry(org.apache.flink.runtime.metrics.MetricRegistry) JobID(org.apache.flink.api.common.JobID) Test(org.junit.Test)

Example 47 with JobID

use of org.apache.flink.api.common.JobID in project flink by apache.

the class JobManagerJobGroupTest method testGenerateScopeCustomWildcard.

@Test
public void testGenerateScopeCustomWildcard() {
    Configuration cfg = new Configuration();
    cfg.setString(ConfigConstants.METRICS_SCOPE_NAMING_JM, "peter");
    cfg.setString(ConfigConstants.METRICS_SCOPE_NAMING_JM_JOB, "*.some-constant.<job_id>");
    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[] { "peter", "some-constant", jid.toString() }, jmGroup.getScopeComponents());
    assertEquals("peter.some-constant." + jid + ".name", jmGroup.getMetricIdentifier("name"));
    registry.shutdown();
}
Also used : MetricRegistryConfiguration(org.apache.flink.runtime.metrics.MetricRegistryConfiguration) Configuration(org.apache.flink.configuration.Configuration) MetricRegistry(org.apache.flink.runtime.metrics.MetricRegistry) JobID(org.apache.flink.api.common.JobID) Test(org.junit.Test)

Example 48 with JobID

use of org.apache.flink.api.common.JobID in project flink by apache.

the class OperatorGroupTest method testVariables.

@Test
public void testVariables() {
    MetricRegistry registry = new MetricRegistry(MetricRegistryConfiguration.defaultMetricRegistryConfiguration());
    JobID jid = new JobID();
    AbstractID tid = new AbstractID();
    AbstractID eid = new AbstractID();
    TaskManagerMetricGroup tmGroup = new TaskManagerMetricGroup(registry, "theHostName", "test-tm-id");
    TaskManagerJobMetricGroup jmGroup = new TaskManagerJobMetricGroup(registry, tmGroup, jid, "myJobName");
    TaskMetricGroup taskGroup = new TaskMetricGroup(registry, jmGroup, tid, eid, "aTaskName", 11, 0);
    OperatorMetricGroup opGroup = new OperatorMetricGroup(registry, taskGroup, "myOpName");
    Map<String, String> variables = opGroup.getAllVariables();
    testVariable(variables, ScopeFormat.SCOPE_HOST, "theHostName");
    testVariable(variables, ScopeFormat.SCOPE_TASKMANAGER_ID, "test-tm-id");
    testVariable(variables, ScopeFormat.SCOPE_JOB_ID, jid.toString());
    testVariable(variables, ScopeFormat.SCOPE_JOB_NAME, "myJobName");
    testVariable(variables, ScopeFormat.SCOPE_TASK_VERTEX_ID, tid.toString());
    testVariable(variables, ScopeFormat.SCOPE_TASK_NAME, "aTaskName");
    testVariable(variables, ScopeFormat.SCOPE_TASK_ATTEMPT_ID, eid.toString());
    testVariable(variables, ScopeFormat.SCOPE_TASK_SUBTASK_INDEX, "11");
    testVariable(variables, ScopeFormat.SCOPE_TASK_ATTEMPT_NUM, "0");
    testVariable(variables, ScopeFormat.SCOPE_OPERATOR_NAME, "myOpName");
    registry.shutdown();
}
Also used : MetricRegistry(org.apache.flink.runtime.metrics.MetricRegistry) AbstractID(org.apache.flink.util.AbstractID) JobID(org.apache.flink.api.common.JobID) Test(org.junit.Test)

Example 49 with JobID

use of org.apache.flink.api.common.JobID in project flink by apache.

the class OperatorGroupTest method testGenerateScopeDefault.

@Test
public void testGenerateScopeDefault() {
    MetricRegistry registry = new MetricRegistry(MetricRegistryConfiguration.defaultMetricRegistryConfiguration());
    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(), new AbstractID(), "aTaskName", 11, 0);
    OperatorMetricGroup opGroup = new OperatorMetricGroup(registry, taskGroup, "myOpName");
    assertArrayEquals(new String[] { "theHostName", "taskmanager", "test-tm-id", "myJobName", "myOpName", "11" }, opGroup.getScopeComponents());
    assertEquals("theHostName.taskmanager.test-tm-id.myJobName.myOpName.11.name", opGroup.getMetricIdentifier("name"));
    registry.shutdown();
}
Also used : MetricRegistry(org.apache.flink.runtime.metrics.MetricRegistry) AbstractID(org.apache.flink.util.AbstractID) JobID(org.apache.flink.api.common.JobID) Test(org.junit.Test)

Example 50 with JobID

use of org.apache.flink.api.common.JobID in project flink by apache.

the class TaskManagerJobGroupTest method testGenerateScopeCustom.

@Test
public void testGenerateScopeCustom() {
    Configuration cfg = new Configuration();
    cfg.setString(ConfigConstants.METRICS_SCOPE_NAMING_TM, "abc");
    cfg.setString(ConfigConstants.METRICS_SCOPE_NAMING_TM_JOB, "some-constant.<job_name>");
    MetricRegistry registry = new MetricRegistry(MetricRegistryConfiguration.fromConfiguration(cfg));
    JobID jid = new JobID();
    TaskManagerMetricGroup tmGroup = new TaskManagerMetricGroup(registry, "theHostName", "test-tm-id");
    JobMetricGroup jmGroup = new TaskManagerJobMetricGroup(registry, tmGroup, jid, "myJobName");
    assertArrayEquals(new String[] { "some-constant", "myJobName" }, jmGroup.getScopeComponents());
    assertEquals("some-constant.myJobName.name", jmGroup.getMetricIdentifier("name"));
    registry.shutdown();
}
Also used : MetricRegistryConfiguration(org.apache.flink.runtime.metrics.MetricRegistryConfiguration) Configuration(org.apache.flink.configuration.Configuration) MetricRegistry(org.apache.flink.runtime.metrics.MetricRegistry) JobID(org.apache.flink.api.common.JobID) Test(org.junit.Test)

Aggregations

JobID (org.apache.flink.api.common.JobID)335 Test (org.junit.Test)274 JobVertexID (org.apache.flink.runtime.jobgraph.JobVertexID)88 IOException (java.io.IOException)74 Configuration (org.apache.flink.configuration.Configuration)72 ExecutionAttemptID (org.apache.flink.runtime.executiongraph.ExecutionAttemptID)61 ExecutionConfig (org.apache.flink.api.common.ExecutionConfig)48 ActorGateway (org.apache.flink.runtime.instance.ActorGateway)47 JobVertex (org.apache.flink.runtime.jobgraph.JobVertex)44 ExecutionVertex (org.apache.flink.runtime.executiongraph.ExecutionVertex)42 JobGraph (org.apache.flink.runtime.jobgraph.JobGraph)38 ArrayList (java.util.ArrayList)37 MetricRegistry (org.apache.flink.runtime.metrics.MetricRegistry)32 KeyGroupRange (org.apache.flink.runtime.state.KeyGroupRange)31 HashMap (java.util.HashMap)29 AllocationID (org.apache.flink.runtime.clusterframework.types.AllocationID)29 FiniteDuration (scala.concurrent.duration.FiniteDuration)28 IntermediateDataSetID (org.apache.flink.runtime.jobgraph.IntermediateDataSetID)24 File (java.io.File)23 UUID (java.util.UUID)23