/** * Sets the value for the appropriate key in the {@link Properties}. * * @param key the key to set * @param value the value for the key */ public static void set(PropertyKey key, Object value) { set(key, String.valueOf(value), Source.RUNTIME); }
/** * Creates a default {@link Configuration} for testing. */ public void initConfiguration() throws IOException { setAlluxioWorkDirectory(); setHostname(); for (Entry<PropertyKey, String> entry : ConfigurationTestUtils .testConfigurationDefaults(mHostname, mWorkDirectory).entrySet()) { Configuration.set(entry.getKey(), entry.getValue()); } Configuration.set(PropertyKey.TEST_MODE, true); Configuration.set(PropertyKey.MASTER_RPC_PORT, 0); Configuration.set(PropertyKey.MASTER_WEB_PORT, 0); Configuration.set(PropertyKey.PROXY_WEB_PORT, 0); Configuration.set(PropertyKey.WORKER_RPC_PORT, 0); Configuration.set(PropertyKey.WORKER_DATA_PORT, 0); Configuration.set(PropertyKey.WORKER_WEB_PORT, 0); }
@Override public void startWorkers() throws Exception { Configuration.set(PropertyKey.WORKER_BLOCK_THREADS_MAX, "100"); super.startWorkers(); }
alluxio.Configuration.set(entry.getKey(), entry.getValue());
private void build() { AuthenticatedClientUser.remove(); LoginUserTestUtils.resetLoginUser(); alluxioLocalCluster = new LocalAlluxioCluster(1); try { alluxioLocalCluster.initConfiguration(); for (Map.Entry<PropertyKey, String> entry : configMap.entrySet()) { alluxio.Configuration.set(entry.getKey(), entry.getValue()); } } catch (IOException e) { LOGGER.error("unable to init configuration for alluxio", e); } }
@Override public void start() throws Exception { mWebServer = new ProxyWebServer(ServiceType.PROXY_WEB.getServiceName(), NetworkAddressUtils.getBindAddress(ServiceType.PROXY_WEB), this); // reset proxy web port Configuration.set(PropertyKey.PROXY_WEB_PORT, Integer.toString(mWebServer.getLocalPort())); mWebServer.start(); mLatch.await(); }
@Override public Boolean call() throws Exception { Configuration.set(PropertyKey.KEY_VALUE_ENABLED, String.valueOf(true)); Configuration .set(PropertyKey.KEY_VALUE_PARTITION_SIZE_BYTES_MAX, String.valueOf(mPartitionLength)); KeyValueSystem kvs = KeyValueSystem.Factory.create(); KeyValueStoreWriter writer = kvs.createStore(mStoreUri); putKeyValuePairs(writer); writer.close(); KeyValueStoreReader reader = kvs.openStore(mStoreUri); boolean pass = getKeyValuePairs(reader); reader.close(); return pass; }
/** * Creates a new local Alluxio master with an isolated work directory and port. * * @return an instance of Alluxio master */ public static LocalAlluxioMaster create() throws IOException { String workDirectory = uniquePath(); FileUtils.deletePathRecursively(workDirectory); Configuration.set(PropertyKey.WORK_DIR, workDirectory); return create(workDirectory); }
@Override protected void startMasters() throws IOException { Configuration.set(PropertyKey.ZOOKEEPER_ENABLED, "true"); Configuration.set(PropertyKey.ZOOKEEPER_ADDRESS, mCuratorServer.getConnectString()); Configuration.set(PropertyKey.ZOOKEEPER_ELECTION_PATH, "/election"); Configuration.set(PropertyKey.ZOOKEEPER_LEADER_PATH, "/leader"); mMasters.add(master); Configuration.set(PropertyKey.MASTER_RPC_PORT, "0"); Configuration.set(PropertyKey.MASTER_RPC_PORT, String.valueOf(getLocalAlluxioMaster().getRpcLocalPort()));
/** * Resets the client pools to the original state. */ protected void resetClientPools() throws IOException { Configuration.set(PropertyKey.USER_METRICS_COLLECTION_ENABLED, false); FileSystemContext.clearCache(); FileSystemContext.get().reset(Configuration.global()); }
Configuration.set(PropertyKey.ZOOKEEPER_ENABLED, isZookeeperMode()); Preconditions.checkNotNull(uri.getHost(), PreconditionMessage.URI_HOST_NULL); Preconditions.checkNotNull(uri.getPort(), PreconditionMessage.URI_PORT_NULL); Configuration.set(PropertyKey.MASTER_HOSTNAME, uri.getHost()); Configuration.set(PropertyKey.MASTER_RPC_PORT, uri.getPort());
mPort = ThriftUtils.getThriftPort(mRpcServerSocket); Configuration.set(PropertyKey.MASTER_RPC_PORT, Integer.toString(mPort)); mRpcBindAddress = NetworkAddressUtils.getBindAddress(ServiceType.MASTER_RPC); mRpcConnectAddress = NetworkAddressUtils.getConnectAddress(ServiceType.MASTER_RPC);
/** * Starts serving web ui server, resetting master web port, adding the metrics servlet to the web * server and starting web ui. */ protected void startServingWebServer() { mWebServer = new MasterWebServer(ServiceType.MASTER_WEB.getServiceName(), NetworkAddressUtils.getBindAddress(ServiceType.MASTER_WEB), this); // reset master web port Configuration.set(PropertyKey.MASTER_WEB_PORT, Integer.toString(mWebServer.getLocalPort())); // Add the metrics servlet to the web server. mWebServer.addHandler(mMetricsServlet.getHandler()); // Add the prometheus metrics servlet to the web server. mWebServer.addHandler(mPMetricsServlet.getHandler()); // start web ui mWebServer.start(); }