Skip to content

Commit

Permalink
extra lock checking in the publish command. (#6558)
Browse files Browse the repository at this point in the history
  • Loading branch information
landreev committed Apr 3, 2020
1 parent bc6e37f commit 31f8df0
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public PublishDatasetResult execute(CommandContext ctxt) throws CommandException

if ((registerGlobalIdsForFiles || validatePhysicalFiles)
&& theDataset.getFiles().size() > ctxt.systemConfig().getPIDAsynchRegFileCount()) {
// TODO: The time it takes to validate the physical files in the dataset
// TODO? The time it takes to validate the physical files in the dataset
// is a function of the total file size, NOT the number of files;
// so that's what we should be checking.
String info = registerGlobalIdsForFiles ? "Registering PIDs for Datafiles and " : "";
Expand Down Expand Up @@ -158,12 +158,18 @@ private void verifyCommandArguments() throws IllegalCommandException {
}

if ( getDataset().isLockedFor(DatasetLock.Reason.Workflow)
|| getDataset().isLockedFor(DatasetLock.Reason.Ingest) ) {
|| getDataset().isLockedFor(DatasetLock.Reason.Ingest)
|| getDataset().isLockedFor(DatasetLock.Reason.finalizePublication)) {
throw new IllegalCommandException("This dataset is locked. Reason: "
+ getDataset().getLocks().stream().map(l -> l.getReason().name()).collect( joining(",") )
+ ". Please try publishing later.", this);
}

if ( getDataset().isLockedFor(DatasetLock.Reason.FileValidationFailed)) {
throw new IllegalCommandException("This dataset cannot be published because some files have been found missing or corrupted. "
+ ". Please contact support to address this.", this);
}

if ( datasetExternallyReleased ) {
if ( ! getDataset().getLatestVersion().isReleased() ) {
throw new IllegalCommandException("Latest version of dataset " + getDataset().getIdentifier() + " is not marked as releasd.", this);
Expand Down

0 comments on commit 31f8df0

Please sign in to comment.