use of com.thinkbiganalytics.metadata.api.jobrepo.job.BatchJobExecution in project kylo by Teradata.
the class JobRepoFeedOperationsProvider method findLatest.
@Override
public List<FeedOperation> findLatest(Feed.ID feedId) {
return metadata.read(() -> {
List<FeedOperation> operations = new ArrayList<>();
Feed feed = this.feedProvider.getFeed(feedId);
if (feed != null) {
BatchJobExecution latestJobExecution = this.jobExecutionProvider.findLatestJobForFeed(feed.getQualifiedName());
if (latestJobExecution != null) {
operations.add(createOperation(latestJobExecution));
}
}
return operations;
});
}
use of com.thinkbiganalytics.metadata.api.jobrepo.job.BatchJobExecution in project kylo by Teradata.
the class JobRepoFeedOperationsProvider method getOperation.
/* (non-Javadoc)
* @see com.thinkbiganalytics.metadata.api.op.FeedOperationsProvider#getOperation(com.thinkbiganalytics.metadata.api.op.FeedOperation.ID)
*/
@Override
public FeedOperation getOperation(ID id) {
OpId opId = (OpId) id;
BatchJobExecution jobExecution = jobExecutionProvider.findByJobExecutionId(new Long(opId.toString()), false);
if (jobExecution != null) {
return createOperation(jobExecution);
} else {
return null;
}
}
use of com.thinkbiganalytics.metadata.api.jobrepo.job.BatchJobExecution in project kylo by Teradata.
the class JobRepoFeedOperationsProvider method getDependentDeltaResults.
@Override
public FeedDependencyDeltaResults getDependentDeltaResults(Feed.ID feedId, Set<String> props) {
Feed feed = this.feedProvider.getFeed(feedId);
if (feed != null) {
String systemFeedName = FeedNameUtil.fullName(feed.getCategory().getSystemName(), feed.getName());
FeedDependencyDeltaResults results = new FeedDependencyDeltaResults(feed.getId().toString(), systemFeedName);
// find this feeds latest completion
BatchJobExecution latest = jobExecutionProvider.findLatestCompletedJobForFeed(systemFeedName);
// get the dependent feeds
List<Feed> dependents = feed.getDependentFeeds();
if (dependents != null) {
for (Feed depFeed : dependents) {
String depFeedSystemName = FeedNameUtil.fullName(depFeed.getCategory().getSystemName(), depFeed.getName());
// find Completed feeds executed since time
Set<BatchJobExecution> jobs = null;
if (latest != null) {
jobs = (Set<BatchJobExecution>) jobExecutionProvider.findJobsForFeedCompletedSince(depFeedSystemName, latest.getStartTime());
} else {
BatchJobExecution job = jobExecutionProvider.findLatestCompletedJobForFeed(depFeedSystemName);
if (job != null) {
jobs = new HashSet<>();
jobs.add(job);
}
}
if (jobs != null) {
for (BatchJobExecution job : jobs) {
DateTime endTime = job.getEndTime();
Map<String, String> executionContext = job.getJobExecutionContextAsMap();
Map<String, Object> map = new HashMap<>();
// filter the map
if (executionContext != null) {
// add those requested to the results map
for (Entry<String, String> entry : executionContext.entrySet()) {
if (props == null || props.isEmpty() || props.contains(entry.getKey())) {
map.put(entry.getKey(), entry.getValue());
}
}
}
results.addFeedExecutionContext(depFeedSystemName, job.getJobExecutionId(), job.getStartTime(), endTime, map);
}
} else {
results.getDependentFeedNames().add(depFeedSystemName);
}
}
}
return results;
} else {
throw new FeedNotFoundException(feedId);
}
}
Aggregations