@SuppressWarnings("unchecked") private void destroyWorkflow() { if (!(workflow instanceof ProgramLifecycle)) { return; } final TransactionControl txControl = Transactions.getTransactionControl(workflowContext.getDefaultTxControl(), Workflow.class, workflow, "destroy"); basicWorkflowToken.setCurrentNode(workflowSpec.getName()); workflowContext.destroyProgram((ProgramLifecycle) workflow, txControl, false); try { workflowStateWriter.setWorkflowToken(workflowRunId, basicWorkflowToken); } catch (Throwable t) { LOG.error("Failed to store the final workflow token of Workflow {}", workflowRunId, t); } if (ProgramStatus.COMPLETED != workflowContext.getState().getStatus()) { return; } try { Set<Operation> fieldLineageOperations = workflowContext.getFieldLineageOperations(); if (!fieldLineageOperations.isEmpty()) { FieldLineageInfo info = new FieldLineageInfo(fieldLineageOperations); fieldLineageWriter.write(workflowRunId, info); } } catch (Throwable t) { LOG.debug("Failed to emit the field lineage operations for Workflow {}", workflowRunId, t); } }
@SuppressWarnings("unchecked") private void destroyWorkflow() { if (!(workflow instanceof ProgramLifecycle)) { return; } final TransactionControl txControl = Transactions.getTransactionControl(workflowContext.getDefaultTxControl(), Workflow.class, workflow, "destroy"); basicWorkflowToken.setCurrentNode(workflowSpec.getName()); workflowContext.destroyProgram((ProgramLifecycle) workflow, txControl, false); try { workflowStateWriter.setWorkflowToken(workflowRunId, basicWorkflowToken); } catch (Throwable t) { LOG.error("Failed to store the final workflow token of Workflow {}", workflowRunId, t); } if (ProgramStatus.COMPLETED != workflowContext.getState().getStatus()) { return; } try { Set<Operation> fieldLineageOperations = workflowContext.getFieldLineageOperations(); if (!fieldLineageOperations.isEmpty()) { FieldLineageInfo info = new FieldLineageInfo(fieldLineageOperations); fieldLineageWriter.write(workflowRunId, info); } } catch (Throwable t) { LOG.debug("Failed to emit the field lineage operations for Workflow {}", workflowRunId, t); } }