@Override public byte[] getBytes(final String key, final byte[] defaultValue) { return this.backingConfig.getBytes(this.prefix + key, defaultValue); }
public byte[] getSerializedStateBackend() { return this.config.getBytes(STATE_BACKEND, null); }
public static <T> T readObjectFromConfig(Configuration config, String key, ClassLoader cl) throws IOException, ClassNotFoundException { byte[] bytes = config.getBytes(key, null); if (bytes == null) { return null; } return deserializeObject(bytes, cl); }
public OperatorID getOperatorID() { byte[] operatorIDBytes = config.getBytes(OPERATOR_ID, null); return new OperatorID(Preconditions.checkNotNull(operatorIDBytes)); }
public static Set<Entry<String, DistributedCacheEntry>> readFileInfoFromConfig(Configuration conf) { int num = conf.getInteger(CACHE_FILE_NUM, 0); if (num == 0) { return Collections.emptySet(); } Map<String, DistributedCacheEntry> cacheFiles = new HashMap<String, DistributedCacheEntry>(); for (int i = 1; i <= num; i++) { String name = conf.getString(CACHE_FILE_NAME + i, null); String filePath = conf.getString(CACHE_FILE_PATH + i, null); boolean isExecutable = conf.getBoolean(CACHE_FILE_EXE + i, false); boolean isDirectory = conf.getBoolean(CACHE_FILE_DIR + i, false); byte[] blobKey = conf.getBytes(CACHE_FILE_BLOB_KEY + i, null); cacheFiles.put(name, new DistributedCacheEntry(filePath, isExecutable, blobKey, isDirectory)); } return cacheFiles.entrySet(); }
assertEquals(Math.E, copy.getDouble("E", 0.0), 0.0); assertEquals(true, copy.getBoolean("shouldbetrue", false)); assertArrayEquals(new byte[] { 1, 2, 3, 4, 5 }, copy.getBytes("bytes sequence", null)); assertEquals(getClass(), copy.getClass("myclass", null, getClass().getClassLoader()));
assertEquals(false, pc.getBoolean("int", true)); assertEquals("5", pc.getString("int", "0")); assertArrayEquals(EMPTY_BYTES, pc.getBytes("int", EMPTY_BYTES)); assertEquals(false, pc.getBoolean("long", true)); assertEquals("15", pc.getString("long", "0")); assertArrayEquals(EMPTY_BYTES, pc.getBytes("long", EMPTY_BYTES)); assertEquals(false, pc.getBoolean("too_long", true)); assertEquals(String.valueOf(TOO_LONG), pc.getString("too_long", "0")); assertArrayEquals(EMPTY_BYTES, pc.getBytes("too_long", EMPTY_BYTES)); assertEquals(false, pc.getBoolean("float", true)); assertTrue(pc.getString("float", "0").startsWith("2.145677")); assertArrayEquals(EMPTY_BYTES, pc.getBytes("float", EMPTY_BYTES)); assertEquals(false, pc.getBoolean("double", true)); assertTrue(pc.getString("double", "0").startsWith("3.1415926535")); assertArrayEquals(EMPTY_BYTES, pc.getBytes("double", EMPTY_BYTES)); assertEquals(false, pc.getBoolean("negative_double", true)); assertTrue(pc.getString("negative_double", "0").startsWith("-1")); assertArrayEquals(EMPTY_BYTES, pc.getBytes("negative_double", EMPTY_BYTES)); assertEquals(false, pc.getBoolean("zero", true)); assertTrue(pc.getString("zero", "-1").startsWith("0")); assertArrayEquals(EMPTY_BYTES, pc.getBytes("zero", EMPTY_BYTES)); assertEquals(false, pc.getBoolean("too_long_double", true));
@Override public byte[] getBytes(final String key, final byte[] defaultValue) { return this.backingConfig.getBytes(this.prefix + key, defaultValue); }
public byte[] getSerializedStateBackend() { return this.config.getBytes(STATE_BACKEND, null); }
public byte[] getSerializedStateBackend() { return this.config.getBytes(STATE_BACKEND, null); }
public static <T> T readObjectFromConfig(Configuration config, String key, ClassLoader cl) throws IOException, ClassNotFoundException { byte[] bytes = config.getBytes(key, null); if (bytes == null) { return null; } return deserializeObject(bytes, cl); }
public static <T> T readObjectFromConfig(Configuration config, String key, ClassLoader cl) throws IOException, ClassNotFoundException { byte[] bytes = config.getBytes(key, null); if (bytes == null) { return null; } return deserializeObject(bytes, cl); }
public OperatorID getOperatorID() { byte[] operatorIDBytes = config.getBytes(OPERATOR_ID, null); return new OperatorID(Preconditions.checkNotNull(operatorIDBytes)); }
@Override public void open(Configuration parameters) throws Exception { super.open(parameters); svb = Serialization.deserializeObject(parameters.getBytes(SVB, null)); this.prior = Serialization.deserializeObject(parameters.getBytes(PRIOR, null)); svb.initLearning(); this.svb.updateNaturalParameterPrior(prior); this.svb.updateNaturalParameterPosteriors(prior); svb.getPlateuStructure().getNonReplictedNodes().forEach(node -> node.setActive(false)); }
@Override public void open(Configuration parameters) throws Exception { super.open(parameters); String bnName = parameters.getString(BN_NAME, ""); ef_bayesianNetwork = Serialization.deserializeObject(parameters.getBytes(EFBN_NAME,null)); getRuntimeContext().addAccumulator(COUNTER_NAME+"_"+bnName, this.counterInstances); }
@Override public void open(Configuration parameters) throws Exception { super.open(parameters); String bnName = parameters.getString(ParameterLearningAlgorithm.BN_NAME, ""); ef_bayesianNetwork = Serialization.deserializeObject(parameters.getBytes(EFBN_NAME, null)); getRuntimeContext().addAccumulator(ParallelMaximumLikelihood2.COUNTER_NAME+"_"+bnName, this.counterInstances); }