Search in sources :

Example 11 with JobConfig

use of alluxio.job.JobConfig in project alluxio by Alluxio.

the class CompactActionTest method dynamicNumFiles.

@Test
public void dynamicNumFiles() {
    final CompactAction compactAction = parse("file.count.max=1000;file.size.min=1024");
    HiveLayout from = TableTestUtils.createLayout("/from");
    HiveLayout to = TableTestUtils.createLayout("/to");
    JobConfig job = compactAction.generateJobConfig(from, to, false);
    assertEquals(CompactConfig.class, job.getClass());
    CompactConfig compact = (CompactConfig) job;
    assertEquals("/from", compact.getInput());
    assertEquals("/to", compact.getOutput());
    assertEquals(1000, compact.getMaxNumFiles());
    assertEquals(1024, compact.getMinFileSize());
}
Also used : HiveLayout(alluxio.table.common.layout.HiveLayout) CompactConfig(alluxio.job.plan.transform.CompactConfig) JobConfig(alluxio.job.JobConfig) Test(org.junit.Test)

Example 12 with JobConfig

use of alluxio.job.JobConfig in project alluxio by Alluxio.

the class CompactActionTest method generateJobConfig.

@Test
public void generateJobConfig() {
    final CompactAction compactAction = parse("file.count.max=12");
    HiveLayout from = TableTestUtils.createLayout("/from");
    HiveLayout to = TableTestUtils.createLayout("/to");
    JobConfig job = compactAction.generateJobConfig(from, to, false);
    assertEquals(CompactConfig.class, job.getClass());
    CompactConfig compact = (CompactConfig) job;
    assertEquals("/from", compact.getInput());
    assertEquals("/to", compact.getOutput());
    assertEquals(12, compact.getMaxNumFiles());
}
Also used : HiveLayout(alluxio.table.common.layout.HiveLayout) CompactConfig(alluxio.job.plan.transform.CompactConfig) JobConfig(alluxio.job.JobConfig) Test(org.junit.Test)

Example 13 with JobConfig

use of alluxio.job.JobConfig in project alluxio by Alluxio.

the class TransformPlanTest method getJobConfigs.

@Test
public void getJobConfigs() {
    HiveLayout from = TableTestUtils.createLayout("/from");
    HiveLayout to = TableTestUtils.createLayout("/to");
    TransformDefinition definition = TransformDefinition.parse("file.count.max=12");
    TransformPlan plan = new TransformPlan(from, to, definition);
    assertEquals(from, plan.getBaseLayout());
    assertEquals(to, plan.getTransformedLayout());
    ArrayList<JobConfig> jobs = plan.getJobConfigs();
    assertEquals(1, jobs.size());
    assertEquals(CompactConfig.class, jobs.get(0).getClass());
    CompactConfig compact = (CompactConfig) jobs.get(0);
    assertEquals("/from", compact.getInput());
    assertEquals("/to", compact.getOutput());
    assertEquals(12, compact.getMaxNumFiles());
}
Also used : HiveLayout(alluxio.table.common.layout.HiveLayout) CompactConfig(alluxio.job.plan.transform.CompactConfig) JobConfig(alluxio.job.JobConfig) Test(org.junit.Test)

Example 14 with JobConfig

use of alluxio.job.JobConfig in project alluxio by Alluxio.

the class JobMasterTest method list.

@Test
public void list() throws Exception {
    PlanCoordinator coordinator = PowerMockito.mock(PlanCoordinator.class);
    mockStatic(PlanCoordinator.class);
    when(PlanCoordinator.create(any(CommandManager.class), any(JobServerContext.class), anyList(), anyLong(), any(JobConfig.class), any(Consumer.class))).thenReturn(coordinator);
    TestPlanConfig jobConfig = new TestPlanConfig("/test");
    List<Long> jobIdList = new ArrayList<>();
    for (long i = 0; i < TEST_JOB_MASTER_JOB_CAPACITY; i++) {
        jobIdList.add(mJobMaster.run(jobConfig));
    }
    final List<Long> list = mJobMaster.list(ListAllPOptions.getDefaultInstance());
    Assert.assertEquals(jobIdList, list);
    Assert.assertEquals(TEST_JOB_MASTER_JOB_CAPACITY, mJobMaster.list(ListAllPOptions.getDefaultInstance()).size());
}
Also used : TestPlanConfig(alluxio.job.TestPlanConfig) JobServerContext(alluxio.job.JobServerContext) CommandManager(alluxio.master.job.command.CommandManager) Consumer(java.util.function.Consumer) ArgumentMatchers.anyLong(org.mockito.ArgumentMatchers.anyLong) ArrayList(java.util.ArrayList) PlanCoordinator(alluxio.master.job.plan.PlanCoordinator) SleepJobConfig(alluxio.job.SleepJobConfig) JobConfig(alluxio.job.JobConfig) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 15 with JobConfig

use of alluxio.job.JobConfig in project alluxio by Alluxio.

the class WorkflowTrackerTest method testEmpty.

@Test
public void testEmpty() throws Exception {
    ArrayList<JobConfig> jobs = Lists.newArrayList();
    CompositeConfig config = new CompositeConfig(jobs, true);
    mWorkflowTracker.run(config, 0);
    WorkflowInfo info = mWorkflowTracker.getStatus(0, true);
    assertEquals(Status.COMPLETED, info.getStatus());
}
Also used : WorkflowInfo(alluxio.job.wire.WorkflowInfo) CompositeConfig(alluxio.job.workflow.composite.CompositeConfig) SleepJobConfig(alluxio.job.SleepJobConfig) JobConfig(alluxio.job.JobConfig) Test(org.junit.Test)

Aggregations

JobConfig (alluxio.job.JobConfig)26 Test (org.junit.Test)17 SleepJobConfig (alluxio.job.SleepJobConfig)10 TestPlanConfig (alluxio.job.TestPlanConfig)9 Serializable (java.io.Serializable)7 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)7 JobServerContext (alluxio.job.JobServerContext)5 CompositeConfig (alluxio.job.workflow.composite.CompositeConfig)5 CommandManager (alluxio.master.job.command.CommandManager)5 WorkerInfo (alluxio.wire.WorkerInfo)5 ArrayList (java.util.ArrayList)5 JobDoesNotExistException (alluxio.exception.JobDoesNotExistException)4 BatchedJobConfig (alluxio.job.plan.BatchedJobConfig)4 PlanInfo (alluxio.job.plan.meta.PlanInfo)4 ResourceExhaustedException (alluxio.exception.status.ResourceExhaustedException)3 RunTaskCommand (alluxio.grpc.RunTaskCommand)3 RunTaskContext (alluxio.job.RunTaskContext)3 CompactConfig (alluxio.job.plan.transform.CompactConfig)3 WorkflowInfo (alluxio.job.wire.WorkflowInfo)3 PlanCoordinator (alluxio.master.job.plan.PlanCoordinator)3