Search in sources :

Example 11 with PartitionDependencyManagerService

use of org.apache.oozie.service.PartitionDependencyManagerService in project oozie by apache.

the class TestCoordActionUpdatePushMissingDependency method testUpdateCoordTableAdvanced.

@Test
public void testUpdateCoordTableAdvanced() throws Exception {
    String newHCatDependency1 = "hcat://hcat.server.com:5080/mydb/clicks/datastamp=11;region=us";
    String newHCatDependency2 = "hcat://hcat.server.com:5080/mydb/clicks/datastamp=12;region=us";
    HCatURI hcatUri1 = new HCatURI(newHCatDependency1);
    HCatURI hcatUri2 = new HCatURI(newHCatDependency2);
    String fullDeps = newHCatDependency1 + CoordELFunctions.INSTANCE_SEPARATOR + newHCatDependency2;
    String actionId = addInitRecords(fullDeps);
    checkCoordAction(actionId, fullDeps, CoordinatorAction.Status.WAITING);
    PartitionDependencyManagerService pdms = Services.get().get(PartitionDependencyManagerService.class);
    pdms.addMissingDependency(hcatUri1, actionId);
    pdms.addMissingDependency(hcatUri2, actionId);
    pdms.partitionAvailable("hcat.server.com:5080", "mydb", "clicks", getPartitionMap("src=search;datastamp=12;region=us"));
    Collection<String> availableURIs = pdms.getAvailableDependencyURIs(actionId);
    assertEquals(1, availableURIs.size());
    assertTrue(availableURIs.contains(newHCatDependency2));
    new CoordActionUpdatePushMissingDependency(actionId).call();
    checkCoordAction(actionId, newHCatDependency1, CoordinatorAction.Status.WAITING);
    // second partition available
    pdms.partitionAvailable("hcat.server.com:5080", "mydb", "clicks", getPartitionMap("src=search;datastamp=11;region=us"));
    availableURIs = pdms.getAvailableDependencyURIs(actionId);
    assertEquals(1, availableURIs.size());
    assertTrue(availableURIs.contains(newHCatDependency1));
    new CoordActionUpdatePushMissingDependency(actionId).call();
    checkCoordAction(actionId, "", CoordinatorAction.Status.READY);
    assertNull(pdms.getAvailableDependencyURIs(actionId));
}
Also used : HCatURI(org.apache.oozie.util.HCatURI) PartitionDependencyManagerService(org.apache.oozie.service.PartitionDependencyManagerService) Test(org.junit.Test)

Example 12 with PartitionDependencyManagerService

use of org.apache.oozie.service.PartitionDependencyManagerService in project oozie by apache.

the class TestCoordActionUpdatePushMissingDependency method testUpdateCoordTableBasic.

@Test
public void testUpdateCoordTableBasic() throws Exception {
    String newHCatDependency = "hcat://hcat.server.com:5080/mydb/clicks/datastamp=12;region=us";
    HCatURI hcatUri = new HCatURI(newHCatDependency);
    String actionId = addInitRecords(newHCatDependency);
    checkCoordAction(actionId, newHCatDependency, CoordinatorAction.Status.WAITING);
    PartitionDependencyManagerService pdms = Services.get().get(PartitionDependencyManagerService.class);
    pdms.addMissingDependency(hcatUri, actionId);
    pdms.partitionAvailable("hcat.server.com:5080", "mydb", "clicks", getPartitionMap("src=search;datastamp=12;region=us"));
    Collection<String> availableURIs = pdms.getAvailableDependencyURIs(actionId);
    assertEquals(availableURIs.size(), 1);
    assertTrue(availableURIs.contains(newHCatDependency));
    new CoordActionUpdatePushMissingDependency(actionId).call();
    checkCoordAction(actionId, "", CoordinatorAction.Status.READY);
    assertNull(pdms.getAvailableDependencyURIs(actionId));
}
Also used : HCatURI(org.apache.oozie.util.HCatURI) PartitionDependencyManagerService(org.apache.oozie.service.PartitionDependencyManagerService) Test(org.junit.Test)

Aggregations

PartitionDependencyManagerService (org.apache.oozie.service.PartitionDependencyManagerService)12 HCatURI (org.apache.oozie.util.HCatURI)11 Test (org.junit.Test)8 HCatAccessorService (org.apache.oozie.service.HCatAccessorService)7 URISyntaxException (java.net.URISyntaxException)2 HCatMessageHandler (org.apache.oozie.dependency.hcat.HCatMessageHandler)2 JPAExecutorException (org.apache.oozie.executor.jpa.JPAExecutorException)2 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 Message (javax.jms.Message)1 MessageProducer (javax.jms.MessageProducer)1 Topic (javax.jms.Topic)1 HCatClient (org.apache.hive.hcatalog.api.HCatClient)1 HCatException (org.apache.hive.hcatalog.common.HCatException)1 HCatEventMessage (org.apache.hive.hcatalog.messaging.HCatEventMessage)1 JSONAddPartitionMessage (org.apache.hive.hcatalog.messaging.json.JSONAddPartitionMessage)1 CoordinatorActionBean (org.apache.oozie.CoordinatorActionBean)1 CoordinatorJobBean (org.apache.oozie.CoordinatorJobBean)1 CommandException (org.apache.oozie.command.CommandException)1 PreconditionException (org.apache.oozie.command.PreconditionException)1