mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-17 13:00:56 +00:00
MINOR: Add missing workflow config status migrations (#21286)
* Add missing workflow config status migrations * Moved to Java based migrations to redeploy pipeline * Moved migrations to Java. Updated Listener based on config * Improved update on the migrations (cherry picked from commit b761efbfd33e1888dc59e0ef7fe636a9a98aa8c5)
This commit is contained in:
parent
43b1aa2f24
commit
5a83cfe640
@ -70,7 +70,8 @@ public interface NodeInterface {
|
|||||||
endEvent.getExecutionListeners().add(listener);
|
endEvent.getExecutionListeners().add(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
default BoundaryEvent getRuntimeExceptionBoundaryEvent(Activity activity) {
|
default BoundaryEvent getRuntimeExceptionBoundaryEvent(
|
||||||
|
Activity activity, Boolean storeStageStatus) {
|
||||||
ErrorEventDefinition runtimeExceptionDefinition = new ErrorEventDefinition();
|
ErrorEventDefinition runtimeExceptionDefinition = new ErrorEventDefinition();
|
||||||
runtimeExceptionDefinition.setErrorCode(WORKFLOW_RUNTIME_EXCEPTION);
|
runtimeExceptionDefinition.setErrorCode(WORKFLOW_RUNTIME_EXCEPTION);
|
||||||
|
|
||||||
@ -80,9 +81,11 @@ public interface NodeInterface {
|
|||||||
runtimeExceptionBoundaryEvent.addEventDefinition(runtimeExceptionDefinition);
|
runtimeExceptionBoundaryEvent.addEventDefinition(runtimeExceptionDefinition);
|
||||||
|
|
||||||
runtimeExceptionBoundaryEvent.setAttachedToRef(activity);
|
runtimeExceptionBoundaryEvent.setAttachedToRef(activity);
|
||||||
|
if (storeStageStatus) {
|
||||||
for (FlowableListener listener : getWorkflowInstanceStageListeners(List.of("end"))) {
|
for (FlowableListener listener : getWorkflowInstanceStageListeners(List.of("end"))) {
|
||||||
runtimeExceptionBoundaryEvent.getExecutionListeners().add(listener);
|
runtimeExceptionBoundaryEvent.getExecutionListeners().add(listener);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return runtimeExceptionBoundaryEvent;
|
return runtimeExceptionBoundaryEvent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,8 @@ public class CheckEntityAttributesTask implements NodeInterface {
|
|||||||
attachWorkflowInstanceStageListeners(subProcess);
|
attachWorkflowInstanceStageListeners(subProcess);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.runtimeExceptionBoundaryEvent = getRuntimeExceptionBoundaryEvent(subProcess);
|
this.runtimeExceptionBoundaryEvent =
|
||||||
|
getRuntimeExceptionBoundaryEvent(subProcess, config.getStoreStageStatus());
|
||||||
this.subProcess = subProcess;
|
this.subProcess = subProcess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,8 @@ public class SetEntityCertificationTask implements NodeInterface {
|
|||||||
attachWorkflowInstanceStageListeners(subProcess);
|
attachWorkflowInstanceStageListeners(subProcess);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.runtimeExceptionBoundaryEvent = getRuntimeExceptionBoundaryEvent(subProcess);
|
this.runtimeExceptionBoundaryEvent =
|
||||||
|
getRuntimeExceptionBoundaryEvent(subProcess, config.getStoreStageStatus());
|
||||||
this.subProcess = subProcess;
|
this.subProcess = subProcess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,8 @@ public class SetGlossaryTermStatusTask implements NodeInterface {
|
|||||||
attachWorkflowInstanceStageListeners(subProcess);
|
attachWorkflowInstanceStageListeners(subProcess);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.runtimeExceptionBoundaryEvent = getRuntimeExceptionBoundaryEvent(subProcess);
|
this.runtimeExceptionBoundaryEvent =
|
||||||
|
getRuntimeExceptionBoundaryEvent(subProcess, config.getStoreStageStatus());
|
||||||
this.subProcess = subProcess;
|
this.subProcess = subProcess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +86,8 @@ public class CreateAndRunIngestionPipelineTask implements NodeInterface {
|
|||||||
attachWorkflowInstanceStageListeners(subProcess);
|
attachWorkflowInstanceStageListeners(subProcess);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.runtimeExceptionBoundaryEvent = getRuntimeExceptionBoundaryEvent(subProcess);
|
this.runtimeExceptionBoundaryEvent =
|
||||||
|
getRuntimeExceptionBoundaryEvent(subProcess, config.getStoreStageStatus());
|
||||||
this.subProcess = subProcess;
|
this.subProcess = subProcess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,8 @@ public class RunAppTask implements NodeInterface {
|
|||||||
attachWorkflowInstanceStageListeners(subProcess);
|
attachWorkflowInstanceStageListeners(subProcess);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.runtimeExceptionBoundaryEvent = getRuntimeExceptionBoundaryEvent(subProcess);
|
this.runtimeExceptionBoundaryEvent =
|
||||||
|
getRuntimeExceptionBoundaryEvent(subProcess, config.getStoreStageStatus());
|
||||||
this.subProcess = subProcess;
|
this.subProcess = subProcess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +103,8 @@ public class UserApprovalTask implements NodeInterface {
|
|||||||
attachWorkflowInstanceStageListeners(subProcess);
|
attachWorkflowInstanceStageListeners(subProcess);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.runtimeExceptionBoundaryEvent = getRuntimeExceptionBoundaryEvent(subProcess);
|
this.runtimeExceptionBoundaryEvent =
|
||||||
|
getRuntimeExceptionBoundaryEvent(subProcess, config.getStoreStageStatus());
|
||||||
this.subProcess = subProcess;
|
this.subProcess = subProcess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.openmetadata.service.migration.mysql.v171;
|
package org.openmetadata.service.migration.mysql.v171;
|
||||||
|
|
||||||
import static org.openmetadata.service.migration.utils.v171.MigrationUtil.updateServiceCharts;
|
import static org.openmetadata.service.migration.utils.v171.MigrationUtil.updateServiceCharts;
|
||||||
|
import static org.openmetadata.service.migration.utils.v171.MigrationUtil.updateWorkflowDefinitions;
|
||||||
|
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import org.openmetadata.service.migration.api.MigrationProcessImpl;
|
import org.openmetadata.service.migration.api.MigrationProcessImpl;
|
||||||
@ -16,5 +17,9 @@ public class Migration extends MigrationProcessImpl {
|
|||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
public void runDataMigration() {
|
public void runDataMigration() {
|
||||||
updateServiceCharts();
|
updateServiceCharts();
|
||||||
|
|
||||||
|
// Updating WorkflowDefinition
|
||||||
|
initializeWorkflowHandler();
|
||||||
|
updateWorkflowDefinitions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.openmetadata.service.migration.postgres.v171;
|
package org.openmetadata.service.migration.postgres.v171;
|
||||||
|
|
||||||
import static org.openmetadata.service.migration.utils.v171.MigrationUtil.updateServiceCharts;
|
import static org.openmetadata.service.migration.utils.v171.MigrationUtil.updateServiceCharts;
|
||||||
|
import static org.openmetadata.service.migration.utils.v171.MigrationUtil.updateWorkflowDefinitions;
|
||||||
|
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import org.openmetadata.service.migration.api.MigrationProcessImpl;
|
import org.openmetadata.service.migration.api.MigrationProcessImpl;
|
||||||
@ -16,5 +17,9 @@ public class Migration extends MigrationProcessImpl {
|
|||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
public void runDataMigration() {
|
public void runDataMigration() {
|
||||||
updateServiceCharts();
|
updateServiceCharts();
|
||||||
|
|
||||||
|
// Updating WorkflowDefinition
|
||||||
|
initializeWorkflowHandler();
|
||||||
|
updateWorkflowDefinitions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,17 @@
|
|||||||
package org.openmetadata.service.migration.utils.v171;
|
package org.openmetadata.service.migration.utils.v171;
|
||||||
|
|
||||||
|
import static org.openmetadata.service.Entity.ADMIN_USER_NAME;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.openmetadata.schema.dataInsight.custom.DataInsightCustomChart;
|
import org.openmetadata.schema.dataInsight.custom.DataInsightCustomChart;
|
||||||
import org.openmetadata.schema.dataInsight.custom.LineChart;
|
import org.openmetadata.schema.dataInsight.custom.LineChart;
|
||||||
import org.openmetadata.schema.dataInsight.custom.LineChartMetric;
|
import org.openmetadata.schema.dataInsight.custom.LineChartMetric;
|
||||||
|
import org.openmetadata.schema.governance.workflows.WorkflowConfiguration;
|
||||||
|
import org.openmetadata.schema.governance.workflows.WorkflowDefinition;
|
||||||
import org.openmetadata.service.jdbi3.DataInsightSystemChartRepository;
|
import org.openmetadata.service.jdbi3.DataInsightSystemChartRepository;
|
||||||
|
import org.openmetadata.service.jdbi3.ListFilter;
|
||||||
|
import org.openmetadata.service.jdbi3.WorkflowDefinitionRepository;
|
||||||
import org.openmetadata.service.util.EntityUtil;
|
import org.openmetadata.service.util.EntityUtil;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@ -14,6 +20,7 @@ public class MigrationUtil {
|
|||||||
private MigrationUtil() {}
|
private MigrationUtil() {}
|
||||||
|
|
||||||
static DataInsightSystemChartRepository dataInsightSystemChartRepository;
|
static DataInsightSystemChartRepository dataInsightSystemChartRepository;
|
||||||
|
static WorkflowDefinitionRepository workflowDefinitionRepository;
|
||||||
|
|
||||||
public static void updateChart(String chartName, Object chartDetails) {
|
public static void updateChart(String chartName, Object chartDetails) {
|
||||||
DataInsightCustomChart chart =
|
DataInsightCustomChart chart =
|
||||||
@ -60,4 +67,26 @@ public class MigrationUtil {
|
|||||||
.withFormula("sum(k='tierSources.Generated')")
|
.withFormula("sum(k='tierSources.Generated')")
|
||||||
.withName("ai"))));
|
.withName("ai"))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void updateWorkflowDefinitions() {
|
||||||
|
workflowDefinitionRepository = new WorkflowDefinitionRepository();
|
||||||
|
List<WorkflowDefinition> workflowDefinitions =
|
||||||
|
workflowDefinitionRepository.listAll(EntityUtil.Fields.EMPTY_FIELDS, new ListFilter());
|
||||||
|
|
||||||
|
for (WorkflowDefinition workflowDefinition : workflowDefinitions) {
|
||||||
|
try {
|
||||||
|
if (workflowDefinition.getConfig() == null) {
|
||||||
|
workflowDefinition.setConfig(new WorkflowConfiguration().withStoreStageStatus(false));
|
||||||
|
} else if (workflowDefinition.getConfig().getStoreStageStatus() == null) {
|
||||||
|
workflowDefinition.getConfig().setStoreStageStatus(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
workflowDefinitionRepository.createOrUpdate(null, workflowDefinition, ADMIN_USER_NAME);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
LOG.warn(ex.toString());
|
||||||
|
LOG.warn(
|
||||||
|
String.format("Error updating workflow definition %s", workflowDefinition.getName()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user