Search in sources :

Example 1 with JobAttempt

use of alluxio.cli.fs.command.job.JobAttempt in project alluxio by Alluxio.

the class DistributedCpCommand method create.

private JobAttempt create(List<Pair<String, String>> filePath, boolean overwrite) {
    int poolSize = filePath.size();
    JobAttempt jobAttempt;
    if (poolSize == 1) {
        Pair<String, String> pair = filePath.iterator().next();
        System.out.println("Copying " + pair.getFirst() + " to " + pair.getSecond());
        jobAttempt = new CopyJobAttempt(mClient, new MigrateConfig(pair.getFirst(), pair.getSecond(), mWriteType, overwrite), new CountingRetry(3));
    } else {
        HashSet<Map<String, String>> configs = Sets.newHashSet();
        ObjectMapper oMapper = new ObjectMapper();
        for (Pair<String, String> pair : filePath) {
            MigrateConfig config = new MigrateConfig(pair.getFirst(), pair.getSecond(), mWriteType, overwrite);
            System.out.println("Copying " + pair.getFirst() + " to " + pair.getSecond());
            Map<String, String> map = oMapper.convertValue(config, Map.class);
            configs.add(map);
        }
        BatchedJobConfig config = new BatchedJobConfig(MigrateConfig.NAME, configs);
        jobAttempt = new BatchedCopyJobAttempt(mClient, config, new CountingRetry(3));
    }
    return jobAttempt;
}
Also used : JobAttempt(alluxio.cli.fs.command.job.JobAttempt) MigrateConfig(alluxio.job.plan.migrate.MigrateConfig) CountingRetry(alluxio.retry.CountingRetry) BatchedJobConfig(alluxio.job.plan.BatchedJobConfig) Map(java.util.Map) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 2 with JobAttempt

use of alluxio.cli.fs.command.job.JobAttempt in project alluxio by Alluxio.

the class DistributedLoadUtils method newJob.

/**
 * Creates a new job to load a file in Alluxio space, makes it resident in memory.
 * @param command The command to execute loading
 * @param filePath The {@link AlluxioURI} path to load into Alluxio memory
 * @param replication The replication of file to load into Alluxio memory
 * @param directCache
 * @param printOut whether print out progress in console
 */
private static JobAttempt newJob(AbstractDistributedJobCommand command, List<URIStatus> filePath, int replication, Set<String> workerSet, Set<String> excludedWorkerSet, Set<String> localityIds, Set<String> excludedLocalityIds, boolean directCache, boolean printOut) {
    JobAttempt jobAttempt = LoadJobAttemptFactory.create(command, filePath, replication, workerSet, excludedWorkerSet, localityIds, excludedLocalityIds, directCache, printOut);
    jobAttempt.run();
    return jobAttempt;
}
Also used : JobAttempt(alluxio.cli.fs.command.job.JobAttempt)

Example 3 with JobAttempt

use of alluxio.cli.fs.command.job.JobAttempt in project alluxio by Alluxio.

the class DistributedCpCommand method newJob.

private JobAttempt newJob(List<Pair<String, String>> pool, boolean overwrite) {
    JobAttempt jobAttempt = create(pool, overwrite);
    jobAttempt.run();
    return jobAttempt;
}
Also used : JobAttempt(alluxio.cli.fs.command.job.JobAttempt)

Aggregations

JobAttempt (alluxio.cli.fs.command.job.JobAttempt)3 BatchedJobConfig (alluxio.job.plan.BatchedJobConfig)1 MigrateConfig (alluxio.job.plan.migrate.MigrateConfig)1 CountingRetry (alluxio.retry.CountingRetry)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Map (java.util.Map)1