use of alluxio.time.ExponentialTimer in project alluxio by Alluxio.
the class PersistJobTest method fields.
/**
* Tests getting and setting fields.
*/
@Test
public void fields() {
Random random = new Random();
long jobId = random.nextLong();
long fileId = random.nextLong();
AlluxioURI uri = new AlluxioURI(CommonUtils.randomAlphaNumString(random.nextInt(10)));
String tempUfsPath = CommonUtils.randomAlphaNumString(random.nextInt(10));
ExponentialTimer timer = new ExponentialTimer(0, 0, 0, 0);
PersistJob.CancelState cancelState = PersistJob.CancelState.values()[random.nextInt(PersistJob.CancelState.values().length)];
PersistJob persistJob = new PersistJob(jobId, fileId, uri, tempUfsPath, timer);
persistJob.setCancelState(cancelState);
Assert.assertEquals(jobId, persistJob.getId());
Assert.assertEquals(fileId, persistJob.getFileId());
Assert.assertEquals(uri, persistJob.getUri());
Assert.assertEquals(tempUfsPath, persistJob.getTempUfsPath());
Assert.assertEquals(timer, persistJob.getTimer());
Assert.assertEquals(cancelState, persistJob.getCancelState());
}
use of alluxio.time.ExponentialTimer in project alluxio by Alluxio.
the class PersistenceTest method checkPersistenceRequested.
private void checkPersistenceRequested(AlluxioURI testFile) throws Exception {
FileInfo fileInfo = mFileSystemMaster.getFileInfo(testFile, GET_STATUS_CONTEXT);
Map<Long, ExponentialTimer> persistRequests = getPersistRequests();
Assert.assertEquals(1, persistRequests.size());
Assert.assertEquals(0, getPersistJobs().size());
Assert.assertTrue(persistRequests.containsKey(fileInfo.getFileId()));
Assert.assertEquals(PersistenceState.TO_BE_PERSISTED.toString(), fileInfo.getPersistenceState());
}
use of alluxio.time.ExponentialTimer in project alluxio by Alluxio.
the class PersistenceTestUtils method pauseScheduler.
/**
* A convenience method to pause scheduling persist jobs.
*
* @param resource the local cluster resource to pause the service for
*/
public static void pauseScheduler(LocalAlluxioClusterResource resource) {
FileSystemMaster nestedMaster = getFileSystemMaster(resource);
Map<Long, ExponentialTimer> persistRequests = Whitebox.getInternalState(nestedMaster, "mPersistRequests");
Whitebox.setInternalState(nestedMaster, "mPersistRequests", new BlackHoleMap<>(persistRequests));
}
use of alluxio.time.ExponentialTimer in project alluxio by Alluxio.
the class PersistenceTestUtils method resumeScheduler.
/**
* A convenience method to resume scheduling persist jobs.
*
* @param resource the local cluster resource to resume the service for
*/
public static void resumeScheduler(LocalAlluxioClusterResource resource) {
FileSystemMaster nestedMaster = getFileSystemMaster(resource);
BlackHoleMap<Long, ExponentialTimer> persistRequests = Whitebox.getInternalState(nestedMaster, "mPersistRequests");
Whitebox.setInternalState(nestedMaster, "mPersistRequests", persistRequests.getInnerMap());
}
Aggregations