mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2026-01-06 04:26:57 +00:00
FIX - Try to install app before initializing the entity (#21033)
* FIX - Try to install app before initializing the entity * FIX - Try to install app before initializing the entity
This commit is contained in:
parent
db979dd44a
commit
2cbf032b1d
@ -63,6 +63,7 @@ import org.openmetadata.schema.type.MetadataOperation;
|
||||
import org.openmetadata.sdk.PipelineServiceClientInterface;
|
||||
import org.openmetadata.service.Entity;
|
||||
import org.openmetadata.service.OpenMetadataApplicationConfig;
|
||||
import org.openmetadata.service.apps.AppException;
|
||||
import org.openmetadata.service.apps.ApplicationHandler;
|
||||
import org.openmetadata.service.apps.scheduler.AppScheduler;
|
||||
import org.openmetadata.service.clients.pipeline.PipelineServiceClientFactory;
|
||||
@ -139,21 +140,29 @@ public class AppResource extends EntityResource<App, AppRepository> {
|
||||
App app = getAppForInit(createApp.getName());
|
||||
if (app == null) {
|
||||
app = mapper.createToEntity(createApp, ADMIN_USER_NAME);
|
||||
scheduleAppIfNeeded(app);
|
||||
repository.initializeEntity(app);
|
||||
} else {
|
||||
scheduleAppIfNeeded(app);
|
||||
}
|
||||
|
||||
// Schedule
|
||||
if (SCHEDULED_TYPES.contains(app.getScheduleType())) {
|
||||
ApplicationHandler.getInstance()
|
||||
.installApplication(
|
||||
app, Entity.getCollectionDAO(), searchRepository, ADMIN_USER_NAME);
|
||||
}
|
||||
} catch (AppException ex) {
|
||||
LOG.warn(
|
||||
"We could not install the application {}. Error: {}",
|
||||
createApp.getName(),
|
||||
ex.getMessage());
|
||||
} catch (Exception ex) {
|
||||
LOG.error("Failed in Creation/Initialization of Application : {}", createApp.getName(), ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void scheduleAppIfNeeded(App app) {
|
||||
if (SCHEDULED_TYPES.contains(app.getScheduleType())) {
|
||||
ApplicationHandler.getInstance()
|
||||
.installApplication(app, Entity.getCollectionDAO(), searchRepository, ADMIN_USER_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
private App getAppForInit(String appName) {
|
||||
try {
|
||||
return repository.getByName(null, appName, repository.getFields("bot,pipelines"), ALL, false);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user