mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-16 04:23:12 +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
@ -32,4 +32,4 @@ SET json = JSON_SET(
|
||||
'$.runtime.enabled',
|
||||
true
|
||||
)
|
||||
WHERE name = 'AutoPilotApplication';
|
||||
WHERE name = 'AutoPilotApplication';
|
||||
|
@ -38,4 +38,4 @@ SET json = jsonb_set(
|
||||
'{runtime,enabled}',
|
||||
'true'
|
||||
)
|
||||
where name = 'AutoPilotApplication';
|
||||
where name = 'AutoPilotApplication';
|
||||
|
@ -70,7 +70,8 @@ public interface NodeInterface {
|
||||
endEvent.getExecutionListeners().add(listener);
|
||||
}
|
||||
|
||||
default BoundaryEvent getRuntimeExceptionBoundaryEvent(Activity activity) {
|
||||
default BoundaryEvent getRuntimeExceptionBoundaryEvent(
|
||||
Activity activity, Boolean storeStageStatus) {
|
||||
ErrorEventDefinition runtimeExceptionDefinition = new ErrorEventDefinition();
|
||||
runtimeExceptionDefinition.setErrorCode(WORKFLOW_RUNTIME_EXCEPTION);
|
||||
|
||||
@ -80,8 +81,10 @@ public interface NodeInterface {
|
||||
runtimeExceptionBoundaryEvent.addEventDefinition(runtimeExceptionDefinition);
|
||||
|
||||
runtimeExceptionBoundaryEvent.setAttachedToRef(activity);
|
||||
for (FlowableListener listener : getWorkflowInstanceStageListeners(List.of("end"))) {
|
||||
runtimeExceptionBoundaryEvent.getExecutionListeners().add(listener);
|
||||
if (storeStageStatus) {
|
||||
for (FlowableListener listener : getWorkflowInstanceStageListeners(List.of("end"))) {
|
||||
runtimeExceptionBoundaryEvent.getExecutionListeners().add(listener);
|
||||
}
|
||||
}
|
||||
return runtimeExceptionBoundaryEvent;
|
||||
}
|
||||
|
@ -55,7 +55,8 @@ public class CheckEntityAttributesTask implements NodeInterface {
|
||||
attachWorkflowInstanceStageListeners(subProcess);
|
||||
}
|
||||
|
||||
this.runtimeExceptionBoundaryEvent = getRuntimeExceptionBoundaryEvent(subProcess);
|
||||
this.runtimeExceptionBoundaryEvent =
|
||||
getRuntimeExceptionBoundaryEvent(subProcess, config.getStoreStageStatus());
|
||||
this.subProcess = subProcess;
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,8 @@ public class SetEntityCertificationTask implements NodeInterface {
|
||||
attachWorkflowInstanceStageListeners(subProcess);
|
||||
}
|
||||
|
||||
this.runtimeExceptionBoundaryEvent = getRuntimeExceptionBoundaryEvent(subProcess);
|
||||
this.runtimeExceptionBoundaryEvent =
|
||||
getRuntimeExceptionBoundaryEvent(subProcess, config.getStoreStageStatus());
|
||||
this.subProcess = subProcess;
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,8 @@ public class SetGlossaryTermStatusTask implements NodeInterface {
|
||||
attachWorkflowInstanceStageListeners(subProcess);
|
||||
}
|
||||
|
||||
this.runtimeExceptionBoundaryEvent = getRuntimeExceptionBoundaryEvent(subProcess);
|
||||
this.runtimeExceptionBoundaryEvent =
|
||||
getRuntimeExceptionBoundaryEvent(subProcess, config.getStoreStageStatus());
|
||||
this.subProcess = subProcess;
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,8 @@ public class CreateAndRunIngestionPipelineTask implements NodeInterface {
|
||||
attachWorkflowInstanceStageListeners(subProcess);
|
||||
}
|
||||
|
||||
this.runtimeExceptionBoundaryEvent = getRuntimeExceptionBoundaryEvent(subProcess);
|
||||
this.runtimeExceptionBoundaryEvent =
|
||||
getRuntimeExceptionBoundaryEvent(subProcess, config.getStoreStageStatus());
|
||||
this.subProcess = subProcess;
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,8 @@ public class RunAppTask implements NodeInterface {
|
||||
attachWorkflowInstanceStageListeners(subProcess);
|
||||
}
|
||||
|
||||
this.runtimeExceptionBoundaryEvent = getRuntimeExceptionBoundaryEvent(subProcess);
|
||||
this.runtimeExceptionBoundaryEvent =
|
||||
getRuntimeExceptionBoundaryEvent(subProcess, config.getStoreStageStatus());
|
||||
this.subProcess = subProcess;
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,8 @@ public class UserApprovalTask implements NodeInterface {
|
||||
attachWorkflowInstanceStageListeners(subProcess);
|
||||
}
|
||||
|
||||
this.runtimeExceptionBoundaryEvent = getRuntimeExceptionBoundaryEvent(subProcess);
|
||||
this.runtimeExceptionBoundaryEvent =
|
||||
getRuntimeExceptionBoundaryEvent(subProcess, config.getStoreStageStatus());
|
||||
this.subProcess = subProcess;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
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.updateWorkflowDefinitions;
|
||||
|
||||
import lombok.SneakyThrows;
|
||||
import org.openmetadata.service.migration.api.MigrationProcessImpl;
|
||||
@ -16,5 +17,9 @@ public class Migration extends MigrationProcessImpl {
|
||||
@SneakyThrows
|
||||
public void runDataMigration() {
|
||||
updateServiceCharts();
|
||||
|
||||
// Updating WorkflowDefinition
|
||||
initializeWorkflowHandler();
|
||||
updateWorkflowDefinitions();
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
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.updateWorkflowDefinitions;
|
||||
|
||||
import lombok.SneakyThrows;
|
||||
import org.openmetadata.service.migration.api.MigrationProcessImpl;
|
||||
@ -16,5 +17,9 @@ public class Migration extends MigrationProcessImpl {
|
||||
@SneakyThrows
|
||||
public void runDataMigration() {
|
||||
updateServiceCharts();
|
||||
|
||||
// Updating WorkflowDefinition
|
||||
initializeWorkflowHandler();
|
||||
updateWorkflowDefinitions();
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,17 @@
|
||||
package org.openmetadata.service.migration.utils.v171;
|
||||
|
||||
import static org.openmetadata.service.Entity.ADMIN_USER_NAME;
|
||||
|
||||
import java.util.List;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.openmetadata.schema.dataInsight.custom.DataInsightCustomChart;
|
||||
import org.openmetadata.schema.dataInsight.custom.LineChart;
|
||||
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.ListFilter;
|
||||
import org.openmetadata.service.jdbi3.WorkflowDefinitionRepository;
|
||||
import org.openmetadata.service.util.EntityUtil;
|
||||
|
||||
@Slf4j
|
||||
@ -14,6 +20,7 @@ public class MigrationUtil {
|
||||
private MigrationUtil() {}
|
||||
|
||||
static DataInsightSystemChartRepository dataInsightSystemChartRepository;
|
||||
static WorkflowDefinitionRepository workflowDefinitionRepository;
|
||||
|
||||
public static void updateChart(String chartName, Object chartDetails) {
|
||||
DataInsightCustomChart chart =
|
||||
@ -60,4 +67,26 @@ public class MigrationUtil {
|
||||
.withFormula("sum(k='tierSources.Generated')")
|
||||
.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