Search in sources :

Example 16 with Snapshot

use of bio.terra.service.snapshot.Snapshot in project jade-data-repo by DataBiosphere.

the class DeleteSnapshotMetadataStep method doStep.

@Override
public StepResult doStep(FlightContext context) {
    Snapshot snapshot = null;
    boolean found = false;
    try {
        found = snapshotDao.delete(snapshotId);
    } catch (SnapshotNotFoundException ex) {
        found = false;
    }
    DeleteResponseModel.ObjectStateEnum stateEnum = (found) ? DeleteResponseModel.ObjectStateEnum.DELETED : DeleteResponseModel.ObjectStateEnum.NOT_FOUND;
    DeleteResponseModel deleteResponseModel = new DeleteResponseModel().objectState(stateEnum);
    FlightUtils.setResponse(context, deleteResponseModel, HttpStatus.OK);
    return StepResult.getStepResultSuccess();
}
Also used : Snapshot(bio.terra.service.snapshot.Snapshot) SnapshotNotFoundException(bio.terra.service.snapshot.exception.SnapshotNotFoundException) DeleteResponseModel(bio.terra.model.DeleteResponseModel)

Example 17 with Snapshot

use of bio.terra.service.snapshot.Snapshot in project jade-data-repo by DataBiosphere.

the class CountSnapshotTableRowsStep method doStep.

@Override
public StepResult doStep(FlightContext flightContext) throws InterruptedException, RetryException {
    Snapshot snapshot = snapshotDao.retrieveSnapshotByName(snapshotReq.getName());
    Map<String, Long> tableRowCounts = bigQueryPdao.getSnapshotTableRowCounts(snapshot);
    snapshotDao.updateSnapshotTableRowCounts(snapshot, tableRowCounts);
    return StepResult.getStepResultSuccess();
}
Also used : Snapshot(bio.terra.service.snapshot.Snapshot)

Example 18 with Snapshot

use of bio.terra.service.snapshot.Snapshot in project jade-data-repo by DataBiosphere.

the class CreateSnapshotFireStoreComputeStep method doStep.

@Override
public StepResult doStep(FlightContext context) {
    Snapshot snapshot = snapshotService.retrieveByName(snapshotReq.getName());
    fileDao.snapshotCompute(snapshot);
    return StepResult.getStepResultSuccess();
}
Also used : Snapshot(bio.terra.service.snapshot.Snapshot)

Example 19 with Snapshot

use of bio.terra.service.snapshot.Snapshot in project jade-data-repo by DataBiosphere.

the class CreateSnapshotFireStoreDataStep method undoStep.

@Override
public StepResult undoStep(FlightContext context) throws InterruptedException {
    // Remove the snapshot file system and any file dependencies created
    Snapshot snapshot = snapshotService.retrieveByName(snapshotReq.getName());
    fileDao.deleteFilesFromSnapshot(snapshot);
    for (SnapshotSource snapshotSource : snapshot.getSnapshotSources()) {
        Dataset dataset = datasetService.retrieve(snapshotSource.getDataset().getId());
        dependencyDao.deleteSnapshotFileDependencies(dataset, snapshot.getId().toString());
    }
    return StepResult.getStepResultSuccess();
}
Also used : Snapshot(bio.terra.service.snapshot.Snapshot) Dataset(bio.terra.service.dataset.Dataset) SnapshotSource(bio.terra.service.snapshot.SnapshotSource)

Aggregations

Snapshot (bio.terra.service.snapshot.Snapshot)19 Dataset (bio.terra.service.dataset.Dataset)9 SnapshotSource (bio.terra.service.snapshot.SnapshotSource)9 StepResult (bio.terra.stairway.StepResult)6 FlightMap (bio.terra.stairway.FlightMap)5 SnapshotRequestContentsModel (bio.terra.model.SnapshotRequestContentsModel)4 IamRole (bio.terra.service.iam.IamRole)4 MismatchedValueException (bio.terra.service.snapshot.exception.MismatchedValueException)4 UUID (java.util.UUID)4 PdaoException (bio.terra.common.exception.PdaoException)3 RowIdMatch (bio.terra.service.snapshot.RowIdMatch)3 SnapshotDataProject (bio.terra.service.snapshot.SnapshotDataProject)3 SnapshotNotFoundException (bio.terra.service.snapshot.exception.SnapshotNotFoundException)3 InvalidQueryException (bio.terra.grammar.exception.InvalidQueryException)2 SnapshotRequestRowIdModel (bio.terra.model.SnapshotRequestRowIdModel)2 SnapshotRequestRowIdTableModel (bio.terra.model.SnapshotRequestRowIdTableModel)2 SnapshotSummaryModel (bio.terra.model.SnapshotSummaryModel)2 SnapshotMapColumn (bio.terra.service.snapshot.SnapshotMapColumn)2 SnapshotMapTable (bio.terra.service.snapshot.SnapshotMapTable)2 BigQueryError (com.google.cloud.bigquery.BigQueryError)2