/** * Update conf. * * @param confoverlay the conf to set */ public void updateConf(Map<String, String> confoverlay) { lensConf.getProperties().putAll(confoverlay); for (Map.Entry<String, String> prop : confoverlay.entrySet()) { this.conf.set(prop.getKey(), prop.getValue()); } }
/** * Update conf. * * @param confoverlay the conf to set */ public void updateConf(Map<String, String> confoverlay) { lensConf.getProperties().putAll(confoverlay); for (Map.Entry<String, String> prop : confoverlay.entrySet()) { this.conf.set(prop.getKey(), prop.getValue()); } } }
/** * Update conf. * * @param confoverlay the conf to set */ public void updateConf(Map<String, String> confoverlay) { lensConf.getProperties().putAll(confoverlay); for (Map.Entry<String, String> prop : confoverlay.entrySet()) { this.conf.set(prop.getKey(), prop.getValue()); } }
/** * Update conf. * * @param confoverlay the conf to set */ public void updateConf(Map<String, String> confoverlay) { lensConf.getProperties().putAll(confoverlay); for (Map.Entry<String, String> prop : confoverlay.entrySet()) { this.conf.set(prop.getKey(), prop.getValue()); } } }
/** * To hive conf. * * @param conf the conf * @return the hive conf */ protected HiveConf toHiveConf(LensConf conf) { HiveConf hiveConf = new HiveConf(); for (String key : conf.getProperties().keySet()) { hiveConf.set(key, conf.getProperties().get(key)); } return hiveConf; }
/** * Gets the lens conf. * * @param conf the conf * @return the lens conf * @throws LensException the lens exception */ public Configuration getLensConf(LensConf conf) throws LensException { Configuration qconf = LensSessionImpl.createDefaultConf(); if (conf != null && !conf.getProperties().isEmpty()) { for (Map.Entry<String, String> entry : conf.getProperties().entrySet()) { qconf.set(entry.getKey(), entry.getValue()); } } return qconf; }
/** * To hive conf. * * @param conf the conf * @return the hive conf */ private HiveConf toHiveConf(LensConf conf) { HiveConf hiveConf = new HiveConf(); for (String key : conf.getProperties().keySet()) { hiveConf.set(key, conf.getProperties().get(key)); } return hiveConf; } }
/** * To lens conf. * * @param conf the conf * @return the lens conf */ private LensConf toLensConf(HiveConf conf) { LensConf lensConf = new LensConf(); lensConf.getProperties().putAll(conf.getValByRegex(".*")); return lensConf; }
public PathValidator(LensConf config) { createDefaultUriProperties(); this.config.addProperties(config.getProperties()); }
/** * Gets the lens conf. * * @param sessionHandle the session handle * @param conf the conf * @return the lens conf * @throws LensException the lens exception */ public Configuration getLensConf(LensSessionHandle sessionHandle, LensConf conf) throws LensException { Configuration qconf = new Configuration(false); for (Map.Entry<String, String> entry : getSession(sessionHandle).getSessionConf()) { qconf.set(entry.getKey(), entry.getValue()); } if (conf != null && !conf.getProperties().isEmpty()) { for (Map.Entry<String, String> entry : conf.getProperties().entrySet()) { qconf.set(entry.getKey(), entry.getValue()); } } qconf.setClassLoader(getSession(sessionHandle).getClassLoader()); return qconf; }
public PathValidator(LensConf config) { createDefaultUriProperties(); this.config.addProperties(config.getProperties()); }
sparkConf = new SparkConf(); registerAlgos(); for (String key : conf.getProperties().keySet()) { if (key.startsWith("lens.ml.sparkdriver.")) { sparkConf.set(key.substring("lens.ml.sparkdriver.".length()), conf.getProperties().get(key));
/** * Gets the prepared status. * * @param ph the ph * @return the prepared status */ @CliCommand(value = "prepQuery details", help = "Get prepared query with handle <prepare_handle>") public String getPreparedStatus( @CliOption(key = {"", "prepare_handle"}, mandatory = true, help = "<prepare_handle>") String ph) { LensPreparedQuery prepared = getClient().getPreparedQuery(QueryPrepareHandle.fromString(ph)); if (prepared != null) { StringBuilder sb = new StringBuilder() .append("User query:").append(prepared.getUserQuery()).append("\n") .append("Prepare handle:").append(prepared.getPrepareHandle()).append("\n") .append("User:").append(prepared.getPreparedUser()).append("\n") .append("Prepared at:").append(prepared.getPreparedTime()).append("\n") .append("Selected driver :").append(prepared.getSelectedDriverName()).append("\n") .append("Driver query:").append(prepared.getDriverQuery()).append("\n"); if (prepared.getConf() != null) { sb.append("Conf:").append(prepared.getConf().getProperties()).append("\n"); } return sb.toString(); } else { return "No such handle"; } }
@Override public boolean updateQueryConf(LensSessionHandle sessionHandle, QueryPrepareHandle prepareHandle, LensConf newconf) throws LensException { try { log.info("UpdatePreparedQueryConf: session:{} prepareHandle:{}", sessionHandle, prepareHandle); acquire(sessionHandle); PreparedQueryContext ctx = getPreparedQueryContext(sessionHandle, prepareHandle); ctx.updateConf(newconf.getProperties()); return true; } finally { release(sessionHandle); } }
/** * Gets the prepared status. * * @param ph the ph * @return the prepared status */ @CliCommand(value = "prepQuery details", help = "Get prepared query with handle <prepare_handle>") public String getPreparedStatus( @CliOption(key = {"", "prepare_handle"}, mandatory = true, help = "<prepare_handle>") String ph) { LensPreparedQuery prepared = getClient().getPreparedQuery(QueryPrepareHandle.fromString(ph)); if (prepared != null) { StringBuilder sb = new StringBuilder() .append("User query:").append(prepared.getUserQuery()).append("\n") .append("Prepare handle:").append(prepared.getPrepareHandle()).append("\n") .append("User:").append(prepared.getPreparedUser()).append("\n") .append("Prepared at:").append(prepared.getPreparedTime()).append("\n") .append("Selected driver :").append(prepared.getSelectedDriverName()).append("\n") .append("Driver query:").append(prepared.getDriverQuery()).append("\n"); if (prepared.getConf() != null) { sb.append("Conf:").append(prepared.getConf().getProperties()).append("\n"); } return sb.toString(); } else { return "No such handle"; } }
Map<String, String> conf; if (sessionconf != null) { conf = sessionconf.getProperties(); } else { conf = new HashMap();
@Override public boolean updateQueryConf(LensSessionHandle sessionHandle, QueryHandle queryHandle, LensConf newconf) throws LensException { try { log.info("UpdateQueryConf: session:{} queryHandle: {}", sessionHandle, queryHandle); acquire(sessionHandle); QueryContext ctx = getUpdatedQueryContext(sessionHandle, queryHandle); if (ctx != null && (ctx.queued())) { ctx.updateConf(newconf.getProperties()); // TODO COnf changed event tobe raised return true; } else { return false; } } finally { release(sessionHandle); } }
String queue = qHelper.getLensQuery(sessionHandleString, qh).getQueryConf().getProperties() .get("mapreduce.job.queuename"); Assert.assertNotNull(queue);
@Test(enabled = true) public void mapJoinTuneOnRestart() throws Exception { sHelper.setAndValidateParam(CubeQueryConfUtil.FAIL_QUERY_ON_PARTIAL_DATA, "false"); String memoryConfKey = "mapreduce.map.memory.mb"; HashMap<String, String> map = LensUtil.getHashMap(DriverConfig.MAX_CONCURRENT_QUERIES, "1"); try { Util.changeConfig(map, hiveDriverConf); lens.restart(); QueryHandle handle = (QueryHandle) qHelper.executeQuery(COST_5).getData(); QueryHandle handle1 = (QueryHandle) qHelper.executeQuery(COST_5).getData(); QueryHandle handle2 = (QueryHandle) qHelper.executeQuery(COST_5).getData(); QueryHandle handle3 = (QueryHandle) qHelper.executeQuery(COST_5).getData(); LensQuery lq = qHelper.getLensQuery(sessionHandleString, handle); String expected = lq.getQueryConf().getProperties().get(memoryConfKey); lens.restart(); LensQuery lq1 = qHelper.getLensQuery(sessionHandleString, handle1); LensQuery lq2 = qHelper.getLensQuery(sessionHandleString, handle2); LensQuery lq3 = qHelper.getLensQuery(sessionHandleString, handle3); Assert.assertEquals(lq1.getQueryConf().getProperties().get(memoryConfKey), expected); Assert.assertEquals(lq2.getQueryConf().getProperties().get(memoryConfKey), expected); Assert.assertEquals(lq3.getQueryConf().getProperties().get(memoryConfKey), expected); } finally { Util.changeConfig(hiveDriverConf); lens.restart(); } }
logger.info("Modified Conf : " + gq.getConf().getProperties().get("lens.query.result.parent.dir")); Assert.assertEquals(gq.getConf().getProperties().get(LensConfConstants.RESULT_SET_PARENT_DIR), "hdfs://lens-test:8020/tmp/lensreports", "Update on Prepared Query Failed!!");