public void removeRealizationsFromProjects(RealizationType type, String realizationName) throws IOException { try (AutoLock lock = prjMapLock.lockForWrite()) { for (ProjectInstance projectInstance : findProjects(type, realizationName)) { projectInstance.removeRealization(type, realizationName); save(projectInstance); } } }
public String getProject() { DataModelDesc modelDesc = getModel(); if (modelDesc == null) { // In case the model for cube not exists in metadata List<ProjectInstance> ownerPrj = ProjectManager.getInstance(config).findProjects(RealizationType.CUBE, name); if (ownerPrj.size() == 1) { return ownerPrj.get(0).getName(); } else { throw new IllegalStateException("No project found for cube " + name); } } else { return getModel().getProject(); } }
@Override public void onEntityChange(Broadcaster broadcaster, String entity, Event event, String cacheKey) throws IOException { String cubeName = cacheKey; if (event == Event.DROP) removeCubeLocal(cubeName); else reloadCubeQuietly(cubeName); for (ProjectInstance prj : ProjectManager.getInstance(config).findProjects(RealizationType.CUBE, cubeName)) { broadcaster.notifyProjectDataUpdate(prj.getName()); } } }
List<ProjectInstance> ownerPrj = ProjectManager.getInstance(config).findProjects(RealizationType.CUBE, name);
private static LookupSnapshotBuildJob initJob(CubeInstance cube, String tableName, String submitter, KylinConfig kylinConfig) { List<ProjectInstance> projList = ProjectManager.getInstance(kylinConfig).findProjects(cube.getType(), cube.getName()); if (projList == null || projList.size() == 0) { throw new RuntimeException("Cannot find the project containing the cube " + cube.getName() + "!!!"); } else if (projList.size() >= 2) { String msg = "Find more than one project containing the cube " + cube.getName() + ". It does't meet the uniqueness requirement!!! "; throw new RuntimeException(msg); } LookupSnapshotBuildJob result = new LookupSnapshotBuildJob(); SimpleDateFormat format = new SimpleDateFormat("z yyyy-MM-dd HH:mm:ss", Locale.ROOT); format.setTimeZone(TimeZone.getTimeZone(kylinConfig.getTimeZone())); result.setDeployEnvName(kylinConfig.getDeployEnv()); result.setProjectName(projList.get(0).getName()); CubingExecutableUtil.setCubeName(cube.getName(), result.getParams()); result.setName(JOB_TYPE + " CUBE - " + cube.getName() + " - " + " TABLE - " + tableName + " - " + format.format(new Date(System.currentTimeMillis()))); result.setSubmitter(submitter); result.setNotifyList(cube.getDescriptor().getNotifyList()); return result; }
public CheckpointExecutable build() { KylinConfig kylinConfig = cube.getConfig(); List<ProjectInstance> projList = ProjectManager.getInstance(kylinConfig).findProjects(cube.getType(), cube.getName()); if (projList == null || projList.size() == 0) { throw new RuntimeException("Cannot find the project containing the cube " + cube.getName() + "!!!"); } else if (projList.size() >= 2) { throw new RuntimeException("Find more than one project containing the cube " + cube.getName() + ". It does't meet the uniqueness requirement!!! "); } CheckpointExecutable checkpointJob = new CheckpointExecutable(); checkpointJob.setSubmitter(submitter); CubingExecutableUtil.setCubeName(cube.getName(), checkpointJob.getParams()); checkpointJob.setName( cube.getName() + " - OPTIMIZE CHECKPOINT - " + format.format(new Date(System.currentTimeMillis()))); checkpointJob.setDeployEnvName(kylinConfig.getDeployEnv()); checkpointJob.setProjectName(projList.get(0).getName()); // Phase 1: Update cube information checkpointJob.addTask(createUpdateCubeInfoAfterCheckpointStep()); // Phase 2: Garbage collection outputSide.addStepPhase5_Cleanup(checkpointJob); return checkpointJob; }
@Override public void onEntityChange(Broadcaster broadcaster, String entity, Event event, String cacheKey) throws IOException { if ("hybrid".equals(entity)) { String hybridName = cacheKey; try (AutoLock l = lock.lockForWrite()) { if (event == Event.DROP) hybridMap.removeLocal(hybridName); else crud.reloadQuietly(hybridName); } for (ProjectInstance prj : ProjectManager.getInstance(config).findProjects(RealizationType.HYBRID, hybridName)) { broadcaster.notifyProjectSchemaUpdate(prj.getName()); } } else if ("cube".equals(entity)) { String cubeName = cacheKey; try (AutoLock l = lock.lockForWrite()) { for (HybridInstance hybrid : getHybridInstancesByChild(RealizationType.CUBE, cubeName)) { crud.reloadQuietly(hybrid.getName()); } } } } }
private static CubingJob initCubingJob(CubeSegment seg, String jobType, String submitter, JobEngineConfig config) { KylinConfig kylinConfig = config.getConfig(); CubeInstance cube = seg.getCubeInstance(); List<ProjectInstance> projList = ProjectManager.getInstance(kylinConfig).findProjects(cube.getType(), cube.getName()); if (projList == null || projList.size() == 0) {
@Test public void test3Delete() throws IOException { HybridManager hybridManager = HybridManager.getInstance(KylinConfig.getInstanceFromEnv()); Assert.assertNull(hybridManager.getHybridInstance("ssb_hybrid")); HybridCubeCLI.main(new String[] { "-name", "ssb_hybrid", "-project", "default", "-model", "ssb", "-cubes", "ssb_cube1,ssb_cube2", "-action", "create" }); Assert.assertNotNull(hybridManager.getHybridInstance("ssb_hybrid")); HybridCubeCLI.main(new String[] { "-name", "ssb_hybrid", "-project", "default", "-model", "ssb", "-action", "delete" }); HybridInstance hybridInstance = hybridManager.getHybridInstance("ssb_hybrid"); Assert.assertNull(hybridInstance); Assert.assertEquals(0, ProjectManager.getInstance(KylinConfig.getInstanceFromEnv()).findProjects(RealizationType.HYBRID, "ssb_hybrid").size()); }
public void removeRealizationsFromProjects(RealizationType type, String realizationName) throws IOException { for (ProjectInstance projectInstance : findProjects(type, realizationName)) { projectInstance.removeRealization(type, realizationName); saveResource(projectInstance); } }
public void removeRealizationsFromProjects(RealizationType type, String realizationName) throws IOException { for (ProjectInstance projectInstance : findProjects(type, realizationName)) { projectInstance.removeRealization(type, realizationName); saveResource(projectInstance); } }
public String getProject() { DataModelDesc modelDesc = getModel(); if (modelDesc == null) { // In case the model for cube not exists in metadata List<ProjectInstance> ownerPrj = ProjectManager.getInstance(config).findProjects(RealizationType.CUBE, name); if (ownerPrj.size() == 1) { return ownerPrj.get(0).getName(); } else { throw new IllegalStateException("No project found for cube " + name); } } else { return getModel().getProject(); } }
public void removeRealizationsFromProjects(RealizationType type, String realizationName) throws IOException { try (AutoLock lock = prjMapLock.lockForWrite()) { for (ProjectInstance projectInstance : findProjects(type, realizationName)) { projectInstance.removeRealization(type, realizationName); save(projectInstance); } } }
@Override public void onEntityChange(Broadcaster broadcaster, String entity, Event event, String cacheKey) throws IOException { String cubeName = cacheKey; if (event == Event.DROP) removeCubeLocal(cubeName); else reloadCubeQuietly(cubeName); for (ProjectInstance prj : ProjectManager.getInstance(config).findProjects(RealizationType.CUBE, cubeName)) { broadcaster.notifyProjectDataUpdate(prj.getName()); } } }
private static LookupSnapshotBuildJob initJob(CubeInstance cube, String tableName, String submitter, KylinConfig kylinConfig) { List<ProjectInstance> projList = ProjectManager.getInstance(kylinConfig).findProjects(cube.getType(), cube.getName()); if (projList == null || projList.size() == 0) { throw new RuntimeException("Cannot find the project containing the cube " + cube.getName() + "!!!"); } else if (projList.size() >= 2) { String msg = "Find more than one project containing the cube " + cube.getName() + ". It does't meet the uniqueness requirement!!! "; throw new RuntimeException(msg); } LookupSnapshotBuildJob result = new LookupSnapshotBuildJob(); SimpleDateFormat format = new SimpleDateFormat("z yyyy-MM-dd HH:mm:ss", Locale.ROOT); format.setTimeZone(TimeZone.getTimeZone(kylinConfig.getTimeZone())); result.setDeployEnvName(kylinConfig.getDeployEnv()); result.setProjectName(projList.get(0).getName()); CubingExecutableUtil.setCubeName(cube.getName(), result.getParams()); result.setName(JOB_TYPE + " CUBE - " + cube.getName() + " - " + " TABLE - " + tableName + " - " + format.format(new Date(System.currentTimeMillis()))); result.setSubmitter(submitter); result.setNotifyList(cube.getDescriptor().getNotifyList()); return result; }
List<ProjectInstance> ownerPrj = ProjectManager.getInstance(config).findProjects(RealizationType.CUBE, name);
public CheckpointExecutable build() { KylinConfig kylinConfig = cube.getConfig(); List<ProjectInstance> projList = ProjectManager.getInstance(kylinConfig).findProjects(cube.getType(), cube.getName()); if (projList == null || projList.size() == 0) { throw new RuntimeException("Cannot find the project containing the cube " + cube.getName() + "!!!"); } else if (projList.size() >= 2) { throw new RuntimeException("Find more than one project containing the cube " + cube.getName() + ". It does't meet the uniqueness requirement!!! "); } CheckpointExecutable checkpointJob = new CheckpointExecutable(); checkpointJob.setSubmitter(submitter); CubingExecutableUtil.setCubeName(cube.getName(), checkpointJob.getParams()); checkpointJob.setName( cube.getName() + " - OPTIMIZE CHECKPOINT - " + format.format(new Date(System.currentTimeMillis()))); checkpointJob.setDeployEnvName(kylinConfig.getDeployEnv()); checkpointJob.setProjectName(projList.get(0).getName()); // Phase 1: Update cube information checkpointJob.addTask(createUpdateCubeInfoAfterCheckpointStep()); // Phase 2: Garbage collection outputSide.addStepPhase5_Cleanup(checkpointJob); return checkpointJob; }
@Override public void onEntityChange(Broadcaster broadcaster, String entity, Event event, String cacheKey) throws IOException { if ("hybrid".equals(entity)) { String hybridName = cacheKey; try (AutoLock l = lock.lockForWrite()) { if (event == Event.DROP) hybridMap.removeLocal(hybridName); else crud.reloadQuietly(hybridName); } for (ProjectInstance prj : ProjectManager.getInstance(config).findProjects(RealizationType.HYBRID, hybridName)) { broadcaster.notifyProjectSchemaUpdate(prj.getName()); } } else if ("cube".equals(entity)) { String cubeName = cacheKey; try (AutoLock l = lock.lockForWrite()) { for (HybridInstance hybrid : getHybridInstancesByChild(RealizationType.CUBE, cubeName)) { crud.reloadQuietly(hybrid.getName()); } } } } }
private static CubingJob initCubingJob(CubeSegment seg, String jobType, String submitter, JobEngineConfig config) { KylinConfig kylinConfig = config.getConfig(); CubeInstance cube = seg.getCubeInstance(); List<ProjectInstance> projList = ProjectManager.getInstance(kylinConfig).findProjects(cube.getType(), cube.getName()); if (projList == null || projList.size() == 0) {