Search in sources :

Example 16 with AlluxioConfiguration

use of alluxio.conf.AlluxioConfiguration in project alluxio by Alluxio.

the class ConfigurationUtilsTest method getJobMasterRpcAddressesDefault.

@Test
public void getJobMasterRpcAddressesDefault() {
    AlluxioConfiguration conf = createConf(Collections.emptyMap());
    String host = NetworkAddressUtils.getLocalHostName(5 * Constants.SECOND_MS);
    assertEquals(Arrays.asList(InetSocketAddress.createUnresolved(host, 20001)), ConfigurationUtils.getJobMasterRpcAddresses(conf));
}
Also used : AlluxioConfiguration(alluxio.conf.AlluxioConfiguration) Test(org.junit.Test)

Example 17 with AlluxioConfiguration

use of alluxio.conf.AlluxioConfiguration in project alluxio by Alluxio.

the class ConfigurationUtilsTest method getJobMasterRpcAddresses.

@Test
public void getJobMasterRpcAddresses() {
    AlluxioConfiguration conf = createConf(ImmutableMap.of(PropertyKey.JOB_MASTER_RPC_ADDRESSES, "host1:99,host2:100"));
    assertEquals(Arrays.asList(InetSocketAddress.createUnresolved("host1", 99), InetSocketAddress.createUnresolved("host2", 100)), ConfigurationUtils.getJobMasterRpcAddresses(conf));
}
Also used : AlluxioConfiguration(alluxio.conf.AlluxioConfiguration) Test(org.junit.Test)

Example 18 with AlluxioConfiguration

use of alluxio.conf.AlluxioConfiguration in project alluxio by Alluxio.

the class ConfigurationUtilsTest method getJobMasterRpcAddressesMasterRpcFallback.

@Test
public void getJobMasterRpcAddressesMasterRpcFallback() {
    AlluxioConfiguration conf = createConf(ImmutableMap.of(PropertyKey.MASTER_RPC_ADDRESSES, "host1:99,host2:100", PropertyKey.JOB_MASTER_RPC_PORT, "50"));
    assertEquals(Arrays.asList(InetSocketAddress.createUnresolved("host1", 50), InetSocketAddress.createUnresolved("host2", 50)), ConfigurationUtils.getJobMasterRpcAddresses(conf));
}
Also used : AlluxioConfiguration(alluxio.conf.AlluxioConfiguration) Test(org.junit.Test)

Example 19 with AlluxioConfiguration

use of alluxio.conf.AlluxioConfiguration in project alluxio by Alluxio.

the class ConfigurationUtilsTest method getMasterRpcAddressesDefault.

@Test
public void getMasterRpcAddressesDefault() {
    AlluxioConfiguration conf = createConf(Collections.emptyMap());
    String host = NetworkAddressUtils.getLocalHostName(5 * Constants.SECOND_MS);
    assertEquals(Arrays.asList(InetSocketAddress.createUnresolved(host, 19998)), ConfigurationUtils.getMasterRpcAddresses(conf));
}
Also used : AlluxioConfiguration(alluxio.conf.AlluxioConfiguration) Test(org.junit.Test)

Example 20 with AlluxioConfiguration

use of alluxio.conf.AlluxioConfiguration in project alluxio by Alluxio.

the class ValidateEnv method validate.

/**
 * Validates environment.
 *
 * @param argv list of arguments
 * @return 0 on success, -1 on validation failures, -2 on invalid arguments
 */
public static int validate(String... argv) throws InterruptedException {
    if (argv.length < 1) {
        printHelp("Target not specified.");
        return -2;
    }
    String command = argv[0];
    String name = null;
    String[] args;
    int argsLength = 0;
    // Find all non-option command line arguments.
    while (argsLength < argv.length && !argv[argsLength].startsWith("-")) {
        argsLength++;
    }
    if (argsLength > 1) {
        name = argv[1];
        args = Arrays.copyOfRange(argv, 2, argv.length);
    } else {
        args = Arrays.copyOfRange(argv, 1, argv.length);
    }
    CommandLine cmd;
    try {
        cmd = parseArgsAndOptions(OPTIONS, args);
    } catch (InvalidArgumentException e) {
        System.err.format("Invalid argument: %s.%n", e.getMessage());
        return -1;
    }
    if (command.equals("list")) {
        // Validate against root path
        AlluxioConfiguration conf = InstancedConfiguration.defaults();
        String rootPath = conf.getString(PropertyKey.MASTER_MOUNT_TABLE_ROOT_UFS);
        ValidateEnv task = new ValidateEnv(rootPath, conf);
        task.printTasks();
        return 0;
    }
    return runTasks(command, name, cmd);
}
Also used : CommandLine(org.apache.commons.cli.CommandLine) InvalidArgumentException(alluxio.exception.status.InvalidArgumentException) AlluxioConfiguration(alluxio.conf.AlluxioConfiguration)

Aggregations

AlluxioConfiguration (alluxio.conf.AlluxioConfiguration)62 Test (org.junit.Test)20 InstancedConfiguration (alluxio.conf.InstancedConfiguration)17 IOException (java.io.IOException)11 AlluxioURI (alluxio.AlluxioURI)7 UnderFileSystemFactory (alluxio.underfs.UnderFileSystemFactory)7 ArrayList (java.util.ArrayList)7 AlluxioProperties (alluxio.conf.AlluxioProperties)5 PropertyKey (alluxio.conf.PropertyKey)5 OpenFilePOptions (alluxio.grpc.OpenFilePOptions)5 HealthCheckClient (alluxio.HealthCheckClient)4 FileSystemContext (alluxio.client.file.FileSystemContext)4 InStreamOptions (alluxio.client.file.options.InStreamOptions)4 InetSocketAddress (java.net.InetSocketAddress)4 Constants (alluxio.Constants)3 AlluxioBlockStore (alluxio.client.block.AlluxioBlockStore)3 FileSystem (alluxio.client.file.FileSystem)3 URIStatus (alluxio.client.file.URIStatus)3 ReadRequest (alluxio.grpc.ReadRequest)3 InputStream (java.io.InputStream)3