use of alluxio.conf.AlluxioConfiguration in project alluxio by Alluxio.
the class MetadataCachingBaseFileSystem method asyncUpdateFileAccessTime.
/**
* Asynchronously update file's last access time.
*
* @param path the path to the file
*/
@VisibleForTesting
public void asyncUpdateFileAccessTime(AlluxioURI path) {
if (mDisableUpdateFileAccessTime) {
return;
}
try {
mAccessTimeUpdater.submit(() -> {
try {
AlluxioConfiguration conf = mFsContext.getPathConf(path);
GetStatusPOptions getStatusOptions = FileSystemOptions.getStatusDefaults(conf).toBuilder().setAccessMode(Bits.READ).setUpdateTimestamps(true).build();
super.getStatus(path, getStatusOptions);
} catch (IOException | AlluxioException e) {
LOG.error("Failed to update access time for " + path, e);
}
});
} catch (RejectedExecutionException e) {
LOG.warn("Failed to submit a task to update access time for {}: {}", path, e.toString());
}
}
use of alluxio.conf.AlluxioConfiguration in project alluxio by Alluxio.
the class AlluxioFuse method main.
/**
* Running this class will mount the file system according to the options passed to this function
* {@link #parseOptions(String[], AlluxioConfiguration)}. The user-space fuse application will
* stay on the foreground and keep the file system mounted. The user can unmount the file system
* by gracefully killing (SIGINT) the process.
*
* @param args arguments to run the command line
*/
public static void main(String[] args) {
LOG.info("Alluxio version: {}-{}", RuntimeConstants.VERSION, ProjectConstants.REVISION);
AlluxioConfiguration conf = InstancedConfiguration.defaults();
FileSystemContext fsContext = FileSystemContext.create(conf);
try {
InetSocketAddress confMasterAddress = fsContext.getMasterClientContext().getConfMasterInquireClient().getPrimaryRpcAddress();
RetryUtils.retry("load cluster default configuration with master " + confMasterAddress, () -> fsContext.getClientContext().loadConfIfNotLoaded(confMasterAddress), RetryUtils.defaultClientRetry(conf.getDuration(PropertyKey.USER_RPC_RETRY_MAX_DURATION), conf.getDuration(PropertyKey.USER_RPC_RETRY_BASE_SLEEP_MS), conf.getDuration(PropertyKey.USER_RPC_RETRY_MAX_SLEEP_MS)));
} catch (IOException e) {
LOG.warn("Failed to load cluster default configuration for Fuse process. " + "Proceed with local configuration for FUSE: {}", e.toString());
}
conf = fsContext.getClusterConf();
final FuseMountOptions opts = parseOptions(args, conf);
if (opts == null) {
System.exit(1);
}
CommonUtils.PROCESS_TYPE.set(CommonUtils.ProcessType.CLIENT);
MetricsSystem.startSinks(conf.getString(PropertyKey.METRICS_CONF_FILE));
if (conf.getBoolean(PropertyKey.FUSE_WEB_ENABLED)) {
FuseWebServer webServer = new FuseWebServer(NetworkAddressUtils.ServiceType.FUSE_WEB.getServiceName(), NetworkAddressUtils.getBindAddress(NetworkAddressUtils.ServiceType.FUSE_WEB, ServerConfiguration.global()));
webServer.start();
}
startJvmMonitorProcess();
try (FileSystem fs = FileSystem.Factory.create(fsContext)) {
FuseUmountable fuseUmountable = launchFuse(fs, conf, opts, true);
} catch (IOException e) {
LOG.error("Failed to launch FUSE", e);
System.exit(-1);
}
}
use of alluxio.conf.AlluxioConfiguration in project alluxio by Alluxio.
the class ValidateEnv method runTasks.
private static int runTasks(String target, String name, CommandLine cmd) throws InterruptedException {
// Validate against root path
AlluxioConfiguration conf = InstancedConfiguration.defaults();
String rootPath = conf.getString(PropertyKey.MASTER_MOUNT_TABLE_ROOT_UFS);
ValidateEnv validate = new ValidateEnv(rootPath, conf);
boolean success;
switch(target) {
case "local":
case "worker":
case "master":
success = validate.validateLocal(target, name, cmd);
break;
case "all":
success = validate.validateMasters(name, cmd);
success = validate.validateWorkers(name, cmd) && success;
success = validate.validateLocal("cluster", name, cmd) && success;
break;
case "workers":
success = validate.validateWorkers(name, cmd);
break;
case "masters":
success = validate.validateMasters(name, cmd);
break;
default:
printHelp("Invalid target.");
return -2;
}
return success ? 0 : -1;
}
use of alluxio.conf.AlluxioConfiguration in project alluxio by Alluxio.
the class StackMain method main.
/**
* @param args arguments
*/
public static void main(String[] args) {
if (args.length < 2) {
System.out.println("Usage: <mountPoint> <sourcePath> <fuseOpts e.g. -obig_writes...>");
System.exit(1);
}
Path root = Paths.get(args[1]);
Path mountPoint = Paths.get(args[0]);
StackFS fs = new StackFS(root, mountPoint);
String[] fuseOpts = new String[args.length - 2];
System.arraycopy(args, 2, fuseOpts, 0, args.length - 2);
try {
AlluxioConfiguration conf = new InstancedConfiguration(ConfigurationUtils.defaults());
CommonUtils.PROCESS_TYPE.set(CommonUtils.ProcessType.CLIENT);
MetricsSystem.startSinks(conf.getString(PropertyKey.METRICS_CONF_FILE));
fs.mount(true, false, fuseOpts);
} catch (Exception e) {
e.printStackTrace();
fs.umount(true);
System.exit(1);
}
}
use of alluxio.conf.AlluxioConfiguration in project alluxio by Alluxio.
the class ShowCommand method run.
@Override
public int run(CommandLine cl) throws IOException {
String targetPath = cl.getArgs()[0];
Configuration configuration = mMetaConfigClient.getConfiguration(GetConfigurationPOptions.getDefaultInstance());
if (cl.hasOption(ALL_OPTION_NAME)) {
Map<String, AlluxioConfiguration> pathConfMap = new HashMap<>();
configuration.getPathConf().forEach((path, conf) -> {
AlluxioProperties properties = new AlluxioProperties();
conf.forEach(property -> {
PropertyKey key = PropertyKey.fromString(property.getName());
properties.set(key, property.getValue());
});
pathConfMap.put(path, new InstancedConfiguration(properties));
});
PathConfiguration pathConf = PathConfiguration.create(pathConfMap);
AlluxioURI targetUri = new AlluxioURI(targetPath);
List<PropertyKey> propertyKeys = new ArrayList<>(pathConf.getPropertyKeys(targetUri));
propertyKeys.sort(Comparator.comparing(PropertyKey::getName));
propertyKeys.forEach(key -> {
pathConf.getConfiguration(targetUri, key).ifPresent(conf -> {
mPrintStream.println(format(key.getName(), conf.get(key)));
});
});
} else if (configuration.getPathConf().containsKey(targetPath)) {
List<Property> properties = configuration.getPathConf().get(targetPath);
properties.sort(Comparator.comparing(Property::getName));
properties.forEach(property -> {
mPrintStream.println(format(property.getName(), property.getValue()));
});
}
return 0;
}
Aggregations