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;
}
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;
}
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;
}
Aggregations