/** * Creates a {@link FileSystemContext} with a null subject. * * @param alluxioConf Alluxio configuration * @return an instance of file system context with no subject associated */ public static FileSystemContext create(AlluxioConfiguration alluxioConf) { return create(null, alluxioConf); }
/** * Creates a {@link FileSystemContext} with the configuration loaded from site-properties. * * @param subject The subject to connect to Alluxio with * @return an instance of file system context with the given subject and site-properties config */ public static FileSystemContext create(Subject subject) { return create(subject, null); }
@Override protected Map<String, Command> loadCommands() { return CommandUtils.loadCommands(JobShell.class.getPackage().getName(), new Class[] {FileSystemContext.class}, new Object[] {FileSystemContext.create(mConfiguration)}); } }
/** * Constructs a new {@link EvictDefinition}. */ public EvictDefinition() { mFsContext = FileSystemContext.create(ServerConfiguration.global()); }
@Override protected Map<String, Command> loadCommands() { return FileSystemShellUtils.loadCommands(FileSystemContext.create(mConfiguration)); } }
public static FileSystem get(ClientContext ctx) { return get(FileSystemContext.create(ctx)); } }
public static FileSystem get(AlluxioConfiguration alluxioConf) { return get(FileSystemContext.create(alluxioConf)); }
/** * @return the {@link FileSystemContext} which can be used to access the cluster */ public synchronized FileSystemContext getFilesystemContext() { if (mFilesystemContext == null) { mFilesystemContext = FileSystemContext.create(null, getMasterInquireClient(), ServerConfiguration.global()); mCloser.register(mFilesystemContext); } return mFilesystemContext; }
/** * Constructs a new {@link PersistDefinition}. */ public PersistDefinition() { mFsContext = FileSystemContext.create(ServerConfiguration.global()); mFileSystem = BaseFileSystem.create(mFsContext); }
/** * Constructs a new {@link LoadDefinition}. */ public LoadDefinition() { mFsContext = FileSystemContext.create(ServerConfiguration.global()); mFileSystem = BaseFileSystem.create(mFsContext); }
/** * Constructs a new {@link ReplicateDefinition} instance with FileSystem context and instance. * */ public ReplicateDefinition() { mFsContext = FileSystemContext.create(ServerConfiguration.global()); mFileSystem = BaseFileSystem.create(mFsContext); }
/** * Constructs a new {@link MoveDefinition}. */ public MoveDefinition() { mFsContext = FileSystemContext.create(ServerConfiguration.global()); mFileSystem = BaseFileSystem.create(mFsContext); }
protected AbstractFileSystemCommand(@Nullable FileSystemContext fsContext) { if (fsContext == null) { fsContext = FileSystemContext.create(new InstancedConfiguration(ConfigurationUtils.defaults())); } mFsContext = fsContext; mFileSystem = FileSystem.Factory.get(fsContext); }
/** * Example program for using checkpoints. * Usage: {@code java -cp <ALLUXIO-VERSION> alluxio.examples.BasicCheckpoint <FileFolder> <Files>} * * @param args the folder for the files and the files to use */ public static void main(String[] args) throws IOException { if (args.length != 2) { System.out.println("java -cp " + RuntimeConstants.ALLUXIO_JAR + " alluxio.examples.BasicCheckpoint <FileFolder> <Files>"); System.exit(-1); } FileSystemContext fsContext = FileSystemContext.create(new InstancedConfiguration(ConfigurationUtils.defaults())); boolean result = CliUtils.runExample(new BasicCheckpoint(args[0], Integer.parseInt(args[1]), fsContext)); System.exit(result ? 0 : 1); } }
/** * @param service thread pool to run the background caching work * @param blockWorker handler to the block worker */ public AsyncCacheRequestManager(ExecutorService service, BlockWorker blockWorker) { mAsyncCacheExecutor = service; mBlockWorker = blockWorker; mPendingRequests = new ConcurrentHashMap<>(); mLocalWorkerHostname = NetworkAddressUtils.getLocalHostName( (int) ServerConfiguration.getMs(PropertyKey.NETWORK_HOST_RESOLUTION_TIMEOUT_MS)); // TODO(zac): Make this object accept FileSystemContext parameter. Shouldn't be creating one // here mFsContext = FileSystemContext.create(ServerConfiguration.global()); }
private static List<TargetInfo> getTargetInfos(String[] targets, AlluxioConfiguration conf) throws IOException { List<TargetInfo> targetInfoList = new ArrayList<>(); for (String target : targets) { if (target.equals(ROLE_MASTER)) { String masterHost = NetworkAddressUtils.getConnectHost(ServiceType.MASTER_WEB, conf); int masterPort = NetworkAddressUtils.getPort(ServiceType.MASTER_WEB, conf); targetInfoList.add(new TargetInfo(masterHost, masterPort, ROLE_MASTER)); } else if (target.equals(ROLE_WORKERS)) { AlluxioBlockStore alluxioBlockStore = AlluxioBlockStore.create(FileSystemContext.create(ClientContext.create(conf))); List<BlockWorkerInfo> workerInfoList = alluxioBlockStore.getAllWorkers(); for (BlockWorkerInfo workerInfo : workerInfoList) { WorkerNetAddress netAddress = workerInfo.getNetAddress(); targetInfoList.add( new TargetInfo(netAddress.getHost(), netAddress.getWebPort(), ROLE_WORKER)); } } else if (target.contains(":")) { String[] hostPortPair = target.split(":"); int port = Integer.parseInt(hostPortPair[1]); targetInfoList.add(new TargetInfo(hostPortPair[0], port, ROLE_WORKER)); } else { throw new IOException("Unrecognized target argument: " + target); } } return targetInfoList; }
Factory.getConnectDetails(alluxioConf)); mFsContext = FileSystemContext.create(subject, alluxioConf);
/** * Checks if the master client service is available. * Throws an exception if fails to determine that the master client service is running. * * @param alluxioConf Alluxio configuration */ public static void checkMasterClientService(AlluxioConfiguration alluxioConf) throws IOException { try (CloseableResource<FileSystemMasterClient> client = FileSystemContext.create(ClientContext.create(alluxioConf)) .acquireMasterClientResource()) { InetSocketAddress address = client.get().getAddress(); List<InetSocketAddress> addresses = Arrays.asList(address); MasterInquireClient inquireClient = new PollingMasterInquireClient(addresses, () -> new ExponentialBackoffRetry(50, 100, 2), alluxioConf); inquireClient.getPrimaryRpcAddress(); } catch (UnavailableException e) { throw new IOException("Cannot connect to Alluxio leader master."); } }
FileSystemContext fsContext = FileSystemContext.create( ClientContext.create(mConf)); for (int i = 0; i < mConf.getInt(PropertyKey.USER_FILE_MASTER_CLIENT_THREADS); i++) {
FileSystemContext.create(new InstancedConfiguration(ConfigurationUtils.defaults())); FileSystem fs = FileSystem.Factory.get(fsContext);