Search in sources :

Example 11 with SchedulerConfigurationData

use of com.linkedin.drelephant.configurations.scheduler.SchedulerConfigurationData in project dr-elephant by linkedin.

the class OozieSchedulerTest method testOozieScheduledJob.

/*
    Job Reference ID: C_ID-ActionName-Depth
    Job Execution ID: Oozie Job ID
    Flow Reference ID: Coordinator ID = C_ID
    Flow Execution ID: Coordinator Action ID = C_ID@1
     */
@Test
public void testOozieScheduledJob() throws Exception {
    SchedulerConfigurationData schedulerConfig = makeConfig("oozie", new HashMap<String, String>());
    OozieScheduler scheduler = new OozieScheduler("id", getOozieProperties(), schedulerConfig, scheduledJobClient);
    assertEquals(coordinatorJobInfo + "-" + actionName + "-0", scheduler.getJobDefId());
    assertEquals(jobInfo, scheduler.getJobExecId());
    assertEquals(coordinatorJobInfo, scheduler.getFlowDefId());
    assertEquals(coordinatorActionInfo, scheduler.getFlowExecId());
    assertEquals(oozieUrl + jobInfo, scheduler.getJobDefUrl());
    assertEquals(oozieUrl + jobInfo, scheduler.getJobExecUrl());
    assertEquals(coordinatorJobInfo, scheduler.getFlowDefUrl());
    assertEquals(coordinatorActionInfo, scheduler.getFlowExecUrl());
    assertEquals(0, scheduler.getWorkflowDepth());
    assertEquals(coordinatorJobInfo + "-" + actionName + "-0", scheduler.getJobName());
    assertEquals("oozie", scheduler.getSchedulerName());
}
Also used : Matchers.anyString(org.mockito.Matchers.anyString) SchedulerConfigurationData(com.linkedin.drelephant.configurations.scheduler.SchedulerConfigurationData) Test(org.junit.Test)

Example 12 with SchedulerConfigurationData

use of com.linkedin.drelephant.configurations.scheduler.SchedulerConfigurationData in project dr-elephant by linkedin.

the class OozieSchedulerTest method testOozieLoadInfoWithMissingProperty.

@Test
public void testOozieLoadInfoWithMissingProperty() {
    SchedulerConfigurationData schedulerConfig = makeConfig("oozie", getDefaultSchedulerParams());
    OozieScheduler scheduler = new OozieScheduler("id", getNonOozieProperties(), schedulerConfig);
    assertEquals(null, scheduler.getFlowDefUrl());
    assertEquals(null, scheduler.getFlowDefId());
    assertEquals(null, scheduler.getFlowExecUrl());
    assertEquals(null, scheduler.getFlowExecId());
    assertEquals(null, scheduler.getJobDefUrl());
    assertEquals(null, scheduler.getJobDefId());
    assertEquals(null, scheduler.getJobExecUrl());
    assertEquals(null, scheduler.getJobExecId());
    assertEquals(null, scheduler.getJobName());
    assertEquals(0, scheduler.getWorkflowDepth());
    assertEquals("oozie", scheduler.getSchedulerName());
}
Also used : SchedulerConfigurationData(com.linkedin.drelephant.configurations.scheduler.SchedulerConfigurationData) Test(org.junit.Test)

Example 13 with SchedulerConfigurationData

use of com.linkedin.drelephant.configurations.scheduler.SchedulerConfigurationData in project dr-elephant by linkedin.

the class OozieSchedulerTest method testOozieLoadInfoWithNullProperty.

@Test
public void testOozieLoadInfoWithNullProperty() {
    SchedulerConfigurationData schedulerConfig = makeConfig("oozie", getDefaultSchedulerParams());
    OozieScheduler scheduler = new OozieScheduler("id", null, schedulerConfig);
    assertEquals(null, scheduler.getFlowDefUrl());
    assertEquals(null, scheduler.getFlowDefId());
    assertEquals(null, scheduler.getFlowExecId());
    assertEquals(null, scheduler.getFlowExecUrl());
    assertEquals(null, scheduler.getJobDefId());
    assertEquals(null, scheduler.getJobDefUrl());
    assertEquals(null, scheduler.getJobExecId());
    assertEquals(null, scheduler.getJobExecUrl());
    assertEquals(null, scheduler.getJobName());
    assertEquals(0, scheduler.getWorkflowDepth());
    assertEquals("oozie", scheduler.getSchedulerName());
}
Also used : SchedulerConfigurationData(com.linkedin.drelephant.configurations.scheduler.SchedulerConfigurationData) Test(org.junit.Test)

Example 14 with SchedulerConfigurationData

use of com.linkedin.drelephant.configurations.scheduler.SchedulerConfigurationData in project dr-elephant by linkedin.

the class OozieSchedulerTest method tesOozieScheduledJobAppNameUnique.

/*
    Job Reference ID: Job AppName-ActionName
    Job Execution ID: Oozie Job ID
    Flow Reference ID: Coordinator Job name
    Flow Execution ID: Coordinator Action ID = C_ID@1
     */
@Test
public void tesOozieScheduledJobAppNameUnique() throws Exception {
    HashMap<String, String> params = new HashMap<String, String>();
    params.put("oozie_app_name_uniqueness", "true");
    SchedulerConfigurationData schedulerConfig = makeConfig("oozie", params);
    OozieScheduler scheduler = new OozieScheduler("id", getOozieProperties(), schedulerConfig, scheduledJobClient);
    assertEquals(jobAppName + "-" + actionName, scheduler.getJobDefId());
    assertEquals(jobInfo, scheduler.getJobExecId());
    assertEquals(coordinatorName, scheduler.getFlowDefId());
    assertEquals(coordinatorActionInfo, scheduler.getFlowExecId());
    assertEquals(oozieUrl + jobInfo, scheduler.getJobDefUrl());
    assertEquals(oozieUrl + jobInfo, scheduler.getJobExecUrl());
    assertEquals(coordinatorJobInfo, scheduler.getFlowDefUrl());
    assertEquals(coordinatorActionInfo, scheduler.getFlowExecUrl());
    assertEquals(0, scheduler.getWorkflowDepth());
    assertEquals(jobAppName + "-" + actionName, scheduler.getJobName());
    assertEquals("oozie", scheduler.getSchedulerName());
}
Also used : HashMap(java.util.HashMap) Matchers.anyString(org.mockito.Matchers.anyString) SchedulerConfigurationData(com.linkedin.drelephant.configurations.scheduler.SchedulerConfigurationData) Test(org.junit.Test)

Example 15 with SchedulerConfigurationData

use of com.linkedin.drelephant.configurations.scheduler.SchedulerConfigurationData in project dr-elephant by linkedin.

the class OozieSchedulerTest method testManualCommittedJob.

/*
    Job Reference ID: Oozie Job ID
    Job Execution ID: Oozie Job ID
    Flow Reference ID: Super Parent Oozie job ID
    Flow Execution ID: Super Parent Oozie job ID
     */
@Test
public void testManualCommittedJob() throws Exception {
    SchedulerConfigurationData schedulerConfig = makeConfig("oozie", new HashMap<String, String>());
    OozieScheduler scheduler = new OozieScheduler("id", getOozieProperties(), schedulerConfig, manualCommittedJobClient);
    assertEquals(jobInfo, scheduler.getJobDefId());
    assertEquals(jobInfo, scheduler.getJobExecId());
    assertEquals(parentJobInfo, scheduler.getFlowDefId());
    assertEquals(parentJobInfo, scheduler.getFlowExecId());
    assertEquals(oozieUrl + jobInfo, scheduler.getJobDefUrl());
    assertEquals(oozieUrl + jobInfo, scheduler.getJobExecUrl());
    assertEquals(oozieUrl + parentJobInfo, scheduler.getFlowDefUrl());
    assertEquals(oozieUrl + parentJobInfo, scheduler.getFlowExecUrl());
    assertEquals(1, scheduler.getWorkflowDepth());
    assertEquals(jobInfo, scheduler.getJobName());
    assertEquals("oozie", scheduler.getSchedulerName());
}
Also used : Matchers.anyString(org.mockito.Matchers.anyString) SchedulerConfigurationData(com.linkedin.drelephant.configurations.scheduler.SchedulerConfigurationData) Test(org.junit.Test)

Aggregations

SchedulerConfigurationData (com.linkedin.drelephant.configurations.scheduler.SchedulerConfigurationData)16 Test (org.junit.Test)12 Matchers.anyString (org.mockito.Matchers.anyString)6 Scheduler (com.linkedin.drelephant.schedulers.Scheduler)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 HashMap (java.util.HashMap)2 Properties (java.util.Properties)2 ApplicationType (com.linkedin.drelephant.analysis.ApplicationType)1 HadoopApplicationData (com.linkedin.drelephant.analysis.HadoopApplicationData)1 WorkflowClient (com.linkedin.drelephant.clients.WorkflowClient)1 SchedulerConfiguration (com.linkedin.drelephant.configurations.scheduler.SchedulerConfiguration)1 AirflowScheduler (com.linkedin.drelephant.schedulers.AirflowScheduler)1 AzkabanScheduler (com.linkedin.drelephant.schedulers.AzkabanScheduler)1 OozieScheduler (com.linkedin.drelephant.schedulers.OozieScheduler)1 File (java.io.File)1 ParseException (java.text.ParseException)1 SimpleDateFormat (java.text.SimpleDateFormat)1 AppResult (models.AppResult)1