use of org.pentaho.metaverse.api.model.IExecutionProfile in project pentaho-metaverse by pentaho.
the class BaseRuntimeExtensionPoint method addRuntimeLineageInfo.
public void addRuntimeLineageInfo(LineageHolder holder) {
// TODO
IMetaverseBuilder builder = holder.getMetaverseBuilder();
IExecutionProfile profile = holder.getExecutionProfile();
}
use of org.pentaho.metaverse.api.model.IExecutionProfile in project pentaho-metaverse by pentaho.
the class JobRuntimeExtensionPoint method createLineGraph.
protected void createLineGraph(final Job job) {
try {
// Get the current execution profile for this transformation
LineageHolder holder = JobLineageHolderMap.getInstance().getLineageHolder(job);
Future lineageTask = holder.getLineageTask();
if (lineageTask != null) {
try {
lineageTask.get();
} catch (InterruptedException e) {
// TODO logger?
e.printStackTrace();
} catch (ExecutionException e) {
// TODO logger?
e.printStackTrace();
}
}
// Get the current execution profile for this job
IExecutionProfile executionProfile = JobLineageHolderMap.getInstance().getLineageHolder(job).getExecutionProfile();
if (executionProfile == null) {
// Something's wrong here, the transStarted method didn't properly store the execution profile. We should know
// the same info, so populate a new ExecutionProfile using the current Trans
executionProfile = new ExecutionProfile();
populateExecutionProfile(executionProfile, job);
}
ExecutionData executionData = (ExecutionData) executionProfile.getExecutionData();
Result result = job.getResult();
if (result != null) {
executionData.setFailureCount(result.getNrErrors());
}
// Export the lineage info (execution profile, lineage graph, etc.)
try {
if (lineageWriter != null && !"none".equals(lineageWriter.getOutputStrategy())) {
// clearOutput right before the first call to outputXYZ().
if ("latest".equals(lineageWriter.getOutputStrategy())) {
lineageWriter.cleanOutput(holder);
}
lineageWriter.outputExecutionProfile(holder);
}
} catch (IOException e) {
log.warn(Messages.getString("ERROR.CouldNotWriteExecutionProfile", job.getName(), e.getMessage()));
log.debug(Messages.getString("ERROR.ErrorDuringAnalysisStackTrace"), e);
}
// lineage information into its own graph
try {
Job parentJob = job.getParentJob();
Trans parentTrans = job.getParentTrans();
if (parentJob == null && parentTrans == null) {
// Add the execution profile information to the lineage graph
addRuntimeLineageInfo(holder);
if (lineageWriter != null && !"none".equals(lineageWriter.getOutputStrategy())) {
lineageWriter.outputLineageGraph(holder);
}
}
} catch (IOException e) {
log.warn(Messages.getString("ERROR.CouldNotWriteLineageGraph", job.getName(), Const.NVL(e.getLocalizedMessage(), "Unspecified")));
log.debug(Messages.getString("ERROR.ErrorDuringAnalysisStackTrace"), e);
}
} catch (Throwable t) {
log.warn(Messages.getString("ERROR.ErrorDuringAnalysis", job.getName(), Const.NVL(t.getLocalizedMessage(), "Unspecified")));
log.debug(Messages.getString("ERROR.ErrorDuringAnalysisStackTrace"), t);
}
}
use of org.pentaho.metaverse.api.model.IExecutionProfile in project pentaho-metaverse by pentaho.
the class JobEntryExternalResourceConsumerListener method addExternalResources.
protected void addExternalResources(Collection<IExternalResourceInfo> resources, JobEntryInterface jobEntry) {
if (resources != null) {
// Add the resources to the execution profile
IExecutionProfile executionProfile = JobLineageHolderMap.getInstance().getLineageHolder(jobEntry.getParentJob()).getExecutionProfile();
if (executionProfile != null) {
String jobEntryName = jobEntry.getName();
Map<String, List<IExternalResourceInfo>> resourceMap = executionProfile.getExecutionData().getExternalResources();
List<IExternalResourceInfo> externalResources = resourceMap.get(jobEntryName);
if (externalResources == null) {
externalResources = new LinkedList<IExternalResourceInfo>();
}
externalResources.addAll(resources);
resourceMap.put(jobEntryName, externalResources);
}
}
}
use of org.pentaho.metaverse.api.model.IExecutionProfile in project pentaho-metaverse by pentaho.
the class JobRuntimeExtensionPointTest method createExecutionProfile.
private void createExecutionProfile(Job job) {
IExecutionProfile executionProfile = mock(IExecutionProfile.class);
IExecutionData executionData = mock(IExecutionData.class);
when(executionProfile.getExecutionData()).thenReturn(executionData);
JobLineageHolderMap.getInstance().getLineageHolder(job).setExecutionProfile(executionProfile);
}
use of org.pentaho.metaverse.api.model.IExecutionProfile in project pentaho-metaverse by pentaho.
the class StepExternalResourceConsumerListenerTest method testCallStepAddExternalResources.
@Test
public void testCallStepAddExternalResources() {
StepExternalResourceConsumerListener stepExtensionPoint = new StepExternalResourceConsumerListener();
stepExtensionPoint.addExternalResources(null, null);
StepInterface mockStep = mock(StepInterface.class);
Trans mockTrans = mock(Trans.class);
when(mockStep.getTrans()).thenReturn(mockTrans);
IExecutionProfile executionProfile = mock(IExecutionProfile.class);
IExecutionData executionData = mock(IExecutionData.class);
when(executionProfile.getExecutionData()).thenReturn(executionData);
LineageHolder holder = new LineageHolder();
holder.setExecutionProfile(executionProfile);
TransLineageHolderMap.getInstance().putLineageHolder(mockTrans, holder);
Collection<IExternalResourceInfo> externalResources = new ArrayList<IExternalResourceInfo>();
stepExtensionPoint.addExternalResources(externalResources, mockStep);
IExternalResourceInfo externalResource = mock(IExternalResourceInfo.class);
externalResources.add(externalResource);
stepExtensionPoint.addExternalResources(externalResources, mockStep);
}
Aggregations