Search in sources :

Example 1 with DataOperation

use of com.thinkbiganalytics.metadata.rest.model.op.DataOperation in project kylo by Teradata.

the class MetadataClientProvider method completeOperation.

@Override
public DataOperation completeOperation(String id, String string, State state) {
    DataOperation op = this.client.getDataOperation(id);
    op.setState(state);
    return this.client.updateDataOperation(op);
}
Also used : DataOperation(com.thinkbiganalytics.metadata.rest.model.op.DataOperation)

Example 2 with DataOperation

use of com.thinkbiganalytics.metadata.rest.model.op.DataOperation in project kylo by Teradata.

the class MetadataClientProvider method completeOperation.

/* (non-Javadoc)
     * @see com.thinkbiganalytics.controller.metadata.MetadataProvider#updateOperation(java.lang.String, java.lang.String, com.thinkbiganalytics.metadata.rest.model.data.Datasource)
     */
@Override
public DataOperation completeOperation(String id, String status, Dataset dataset) {
    DataOperation op = this.client.getDataOperation(id);
    op.setStatus(status);
    op.setDataset(dataset);
    op.setState(State.SUCCESS);
    return this.client.updateDataOperation(op);
}
Also used : DataOperation(com.thinkbiganalytics.metadata.rest.model.op.DataOperation)

Example 3 with DataOperation

use of com.thinkbiganalytics.metadata.rest.model.op.DataOperation in project kylo by Teradata.

the class MetadataClientProviderTest method testBeginOperation.

@Test
public void testBeginOperation() {
    Feed feed = this.provider.ensureFeed("category", "test9", "");
    Datasource ds = this.provider.ensureDirectoryDatasource("test9", "", Paths.get("aaa", "bbb"));
    feed = this.provider.ensureFeedDestination(feed.getId(), ds.getId());
    FeedDestination dest = feed.getDestination(ds.getId());
    DataOperation op = this.provider.beginOperation(dest, new DateTime());
    assertThat(op).isNotNull();
    assertThat(op.getState()).isEqualTo(State.IN_PROGRESS);
}
Also used : DirectoryDatasource(com.thinkbiganalytics.metadata.rest.model.data.DirectoryDatasource) Datasource(com.thinkbiganalytics.metadata.rest.model.data.Datasource) HiveTableDatasource(com.thinkbiganalytics.metadata.rest.model.data.HiveTableDatasource) DataOperation(com.thinkbiganalytics.metadata.rest.model.op.DataOperation) FeedDestination(com.thinkbiganalytics.metadata.rest.model.feed.FeedDestination) DateTime(org.joda.time.DateTime) Feed(com.thinkbiganalytics.metadata.rest.model.feed.Feed) FeedExecutedSinceFeed(com.thinkbiganalytics.metadata.api.sla.FeedExecutedSinceFeed) Test(org.junit.Test)

Example 4 with DataOperation

use of com.thinkbiganalytics.metadata.rest.model.op.DataOperation in project kylo by Teradata.

the class MetadataClientTest method testBeginOperation.

// @Test
public void testBeginOperation() throws ParseException {
    Feed feed = buildFeed("category", "feed1").post();
    HiveTableDatasource ds = buildHiveTableDatasource("test-table").post();
    feed = client.addDestination(feed.getId(), ds.getId());
    String destId = feed.getDestinations().iterator().next().getId();
    DataOperation op = client.beginOperation(destId, "");
    assertThat(op).isNotNull();
}
Also used : DataOperation(com.thinkbiganalytics.metadata.rest.model.op.DataOperation) Feed(com.thinkbiganalytics.metadata.rest.model.feed.Feed) FeedExecutedSinceFeed(com.thinkbiganalytics.metadata.api.sla.FeedExecutedSinceFeed) HiveTableDatasource(com.thinkbiganalytics.metadata.rest.model.data.HiveTableDatasource)

Example 5 with DataOperation

use of com.thinkbiganalytics.metadata.rest.model.op.DataOperation in project kylo by Teradata.

the class MetadataClientTest method testCompleteOperation.

// @Test
public void testCompleteOperation() throws ParseException {
    Feed feedA = buildFeed("category", "feedA").post();
    HiveTableDatasource dsA = buildHiveTableDatasource("test-table").post();
    feedA = client.addDestination(feedA.getId(), dsA.getId());
    Feed feedB = buildFeed("category", "feedB", "category", "feedA").post();
    feedB = client.addSource(feedB.getId(), dsA.getId());
    String destA = feedA.getDestinations().iterator().next().getId();
    DataOperation op = client.beginOperation(destA, "");
    op.setState(State.SUCCESS);
    HiveTablePartitions changeSet = new HiveTablePartitions();
    changeSet.setPartitions(Arrays.asList(new HiveTablePartition("month", null, "Jan", "Feb"), new HiveTablePartition("year", null, "2015", "2016")));
    Dataset dataset = new Dataset(new DateTime(), dsA, ChangeType.UPDATE, ContentType.PARTITIONS, changeSet);
    op.setDataset(dataset);
    op = client.updateDataOperation(op);
    assertThat(op).isNotNull();
}
Also used : DataOperation(com.thinkbiganalytics.metadata.rest.model.op.DataOperation) HiveTablePartition(com.thinkbiganalytics.metadata.rest.model.data.HiveTablePartition) HiveTablePartitions(com.thinkbiganalytics.metadata.rest.model.op.HiveTablePartitions) Dataset(com.thinkbiganalytics.metadata.rest.model.op.Dataset) DateTime(org.joda.time.DateTime) Feed(com.thinkbiganalytics.metadata.rest.model.feed.Feed) FeedExecutedSinceFeed(com.thinkbiganalytics.metadata.api.sla.FeedExecutedSinceFeed) HiveTableDatasource(com.thinkbiganalytics.metadata.rest.model.data.HiveTableDatasource)

Aggregations

DataOperation (com.thinkbiganalytics.metadata.rest.model.op.DataOperation)8 FeedExecutedSinceFeed (com.thinkbiganalytics.metadata.api.sla.FeedExecutedSinceFeed)5 Feed (com.thinkbiganalytics.metadata.rest.model.feed.Feed)5 DateTime (org.joda.time.DateTime)5 HiveTableDatasource (com.thinkbiganalytics.metadata.rest.model.data.HiveTableDatasource)4 FeedDestination (com.thinkbiganalytics.metadata.rest.model.feed.FeedDestination)3 Dataset (com.thinkbiganalytics.metadata.rest.model.op.Dataset)3 Datasource (com.thinkbiganalytics.metadata.rest.model.data.Datasource)2 DirectoryDatasource (com.thinkbiganalytics.metadata.rest.model.data.DirectoryDatasource)2 Test (org.junit.Test)2 HiveTablePartition (com.thinkbiganalytics.metadata.rest.model.data.HiveTablePartition)1 HiveTablePartitions (com.thinkbiganalytics.metadata.rest.model.op.HiveTablePartitions)1 ServiceLevelAssessment (com.thinkbiganalytics.metadata.rest.model.sla.ServiceLevelAssessment)1 MetadataProvider (com.thinkbiganalytics.nifi.core.api.metadata.MetadataProvider)1 FlowFile (org.apache.nifi.flowfile.FlowFile)1 ProcessException (org.apache.nifi.processor.exception.ProcessException)1