use of bio.terra.stairway.FlightMap in project jade-data-repo by DataBiosphere.
the class IngestPopulateFileStateFromArrayStep method doStep.
@Override
public StepResult doStep(FlightContext context) {
FlightMap inputParameters = context.getInputParameters();
BulkLoadArrayRequestModel loadRequest = inputParameters.get(JobMapKeys.REQUEST.getKeyName(), BulkLoadArrayRequestModel.class);
FlightMap workingMap = context.getWorkingMap();
UUID loadId = UUID.fromString(workingMap.get(LoadMapKeys.LOAD_ID, String.class));
loadService.populateFiles(loadId, loadRequest.getLoadArray());
return StepResult.getStepResultSuccess();
}
use of bio.terra.stairway.FlightMap in project jade-data-repo by DataBiosphere.
the class IngestPopulateFileStateFromArrayStep method undoStep.
@Override
public StepResult undoStep(FlightContext context) {
FlightMap workingMap = context.getWorkingMap();
UUID loadId = UUID.fromString(workingMap.get(LoadMapKeys.LOAD_ID, String.class));
loadService.cleanFiles(loadId);
return StepResult.getStepResultSuccess();
}
use of bio.terra.stairway.FlightMap in project jade-data-repo by DataBiosphere.
the class IngestPopulateFileStateFromFileStep method undoStep.
@Override
public StepResult undoStep(FlightContext context) {
FlightMap workingMap = context.getWorkingMap();
UUID loadId = UUID.fromString(workingMap.get(LoadMapKeys.LOAD_ID, String.class));
loadService.cleanFiles(loadId);
return StepResult.getStepResultSuccess();
}
use of bio.terra.stairway.FlightMap in project jade-data-repo by DataBiosphere.
the class DeleteFileLookupStep method doStep.
@Override
public StepResult doStep(FlightContext context) throws InterruptedException {
if (configService.testInsertFault(ConfigEnum.FILE_DELETE_LOCK_CONFLICT_STOP_FAULT)) {
logger.info("FILE_DELETE_LOCK_CONFLICT_STOP_FAULT");
while (!configService.testInsertFault(ConfigEnum.FILE_DELETE_LOCK_CONFLICT_CONTINUE_FAULT)) {
logger.info("Sleeping for CONTINUE FAULT");
TimeUnit.SECONDS.sleep(5);
}
logger.info("FILE_DELETE_LOCK_CONFLICT_CONTINUE_FAULT");
}
try {
// If we are restarting, we may have already retrieved and saved the file,
// so we check the working map before doing the lookup.
FlightMap workingMap = context.getWorkingMap();
FireStoreFile fireStoreFile = workingMap.get(FileMapKeys.FIRESTORE_FILE, FireStoreFile.class);
if (fireStoreFile == null) {
fireStoreFile = fileDao.lookupFile(dataset, fileId);
if (fireStoreFile != null) {
workingMap.put(FileMapKeys.FIRESTORE_FILE, fireStoreFile);
}
}
// steps know there is no file. If there is a file, check dependencies here.
if (fireStoreFile != null) {
if (dependencyDao.fileHasSnapshotReference(dataset, fireStoreFile.getFileId())) {
throw new FileDependencyException("File is used by at least one snapshot and cannot be deleted");
}
}
} catch (FileSystemAbortTransactionException rex) {
return new StepResult(StepStatus.STEP_RESULT_FAILURE_RETRY, rex);
}
return StepResult.getStepResultSuccess();
}
use of bio.terra.stairway.FlightMap in project jade-data-repo by DataBiosphere.
the class DeleteFilePrimaryDataStep method doStep.
@Override
public StepResult doStep(FlightContext context) {
FlightMap workingMap = context.getWorkingMap();
FireStoreFile fireStoreFile = workingMap.get(FileMapKeys.FIRESTORE_FILE, FireStoreFile.class);
if (fireStoreFile != null) {
GoogleBucketResource bucketResource = locationService.lookupBucket(fireStoreFile.getBucketResourceId());
gcsPdao.deleteFileByGspath(fireStoreFile.getGspath(), bucketResource);
}
return StepResult.getStepResultSuccess();
}
Aggregations