executionConfig.put("mode", metadata.getMode().name()); executionConfig.put(MetricConfigs.METRIC_PREFIX_CONF, APP_METRIC_PREFIX);
updateSql += "apptype = ?, "; if (entity.getMode() != null && StringUtils.isNotBlank(entity.getMode().name())) { updateSql += "appmode = ?, ";
ApplicationEntity.Status status = null; try { if (Objects.equals(config.getString("mode"), ApplicationEntity.Mode.CLUSTER.name())) { Nimbus.Client stormClient = NimbusClient.getConfiguredClient(getStormConfig(config)).getClient(); topologySummaries = stormClient.getClusterInfo().get_topologies();
LOG.info("Starting {} ({}), mode: {}",topologyName, executor.getClass().getCanonicalName(), config.getString("mode")); Config conf = getStormConfig(config); if (ApplicationEntity.Mode.CLUSTER.name().equalsIgnoreCase(config.getString("mode"))) { String jarFile = config.hasPath("jarPath") ? config.getString("jarPath") : null; if (jarFile == null) {
@Override public ApplicationEntity apply(ResultSet resultSet) throws SQLException { ApplicationDesc applicationDesc = new ApplicationDesc(); String appType = resultSet.getString(4); applicationDesc.setType(appType); SiteEntity siteEntity = new SiteEntity(); siteEntity.setUuid(resultSet.getString(12)); siteEntity.setSiteId(resultSet.getString(13)); siteEntity.setSiteName(resultSet.getString(14)); siteEntity.setDescription(resultSet.getString(15)); siteEntity.setCreatedTime(resultSet.getLong(16)); siteEntity.setModifiedTime(resultSet.getLong(17)); ApplicationEntity resultEntity = new ApplicationEntity(); resultEntity.setUuid(resultSet.getString(1)); resultEntity.setAppId(resultSet.getString(2)); resultEntity.setSite(siteEntity); resultEntity.setDescriptor(applicationDesc); resultEntity.setMode(ApplicationEntity.Mode.valueOf(resultSet.getString(5))); resultEntity.setJarPath(resultSet.getString(6)); resultEntity.setStatus(ApplicationEntity.Status.valueOf(resultSet.getString(7))); resultEntity.setConfiguration(parse(resultSet.getString(8))); resultEntity.setContext(parse(resultSet.getString(9))); resultEntity.setCreatedTime(resultSet.getLong(10)); resultEntity.setModifiedTime(resultSet.getLong(11)); return resultEntity; }
@Override public void stop(Application<StormEnvironment, StormTopology> executor, com.typesafe.config.Config config) { String appId = config.getString("appId"); LOG.info("Stopping topology {} ...", appId); if (Objects.equals(config.getString("mode"), ApplicationEntity.Mode.CLUSTER.name())) { Nimbus.Client stormClient = NimbusClient.getConfiguredClient(getStormConfig(config)).getClient(); try { stormClient.killTopologyWithOpts(appId, this.killOptions); } catch (NotAliveException | TException e) { LOG.error("Failed to kill topology named {}, due to: {}",appId,e.getMessage(),e.getCause()); throw new RuntimeException(e.getMessage(),e); } } else { getLocalCluster().killTopologyWithOpts(appId, this.killOptions); } LOG.info("Stopped topology {}", appId); }
public ApplicationExecutionConfig(ApplicationEntity metadata) { this.siteId = metadata.getSite().getSiteId(); this.mode = metadata.getMode().name(); this.appId = metadata.getAppId(); this.jarPath = metadata.getJarPath(); }