use of alluxio.job.plan.migrate.MigrateConfig 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.job.plan.migrate.MigrateConfig in project alluxio by Alluxio.
the class DistributedCommandsStatsTest method testDistributedCpCancelStats.
@Test
public void testDistributedCpCancelStats() throws Exception {
FileSystemTestUtils.createByteFile(sFileSystem, "/testFileSource", WritePType.THROUGH, 10);
long jobId = sJobMaster.run(new MigrateConfig("/testFileSource", "/testFileDest", "THROUGH", false));
sJobShell.run("cancel", Long.toString(jobId));
JobTestUtils.waitForJobStatus(sJobMaster, jobId, Sets.newHashSet(Status.CANCELED), TEST_TIMEOUT);
sJobShell.run("stat", "-v", Long.toString(jobId));
String[] output = mOutput.toString().split("\n");
assertEquals(String.format("ID: %s", jobId), output[0]);
assertEquals(String.format("Name: Migrate"), output[1]);
assertTrue(output[2].contains("Description: MigrateConfig"));
assertTrue(output[2].contains("/testFileSource"));
assertTrue(output[2].contains("/testFileDest"));
assertEquals("Status: CANCELED", output[3]);
assertEquals("Task 0", output[4]);
assertTrue(output[5].contains("\tWorker: "));
assertEquals("\tStatus: CANCELED", output[7]);
double cancelledCount = MetricsSystem.getMetricValue(MetricKey.MASTER_MIGRATE_JOB_CANCEL.getName()).getValue();
double failedCount = MetricsSystem.getMetricValue(MetricKey.MASTER_MIGRATE_JOB_FAIL.getName()).getValue();
double completedCount = MetricsSystem.getMetricValue(MetricKey.MASTER_MIGRATE_JOB_SUCCESS.getName()).getValue();
assertEquals(cancelledCount, 1, 0);
assertEquals(failedCount, 0, 0);
assertEquals(completedCount, 0, 0);
}
Aggregations