Skip to content

Commit

Permalink
Merge pull request #1720 from dandi/remove-unneeded-atomic
Browse files Browse the repository at this point in the history
  • Loading branch information
mvandenburgh authored Oct 18, 2023
2 parents dfe8bf3 + a5b5786 commit dec4409
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
10 changes: 5 additions & 5 deletions dandiapi/api/services/publish/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,12 @@ def _publish_dandiset(dandiset_id: int) -> None:
Calling `_lock_dandiset_for_publishing()` is a precondition for calling this function.
"""
old_version: Version = Version.objects.select_for_update().get(
dandiset_id=dandiset_id,
version='draft',
)

with transaction.atomic():
old_version: Version = Version.objects.select_for_update().get(
dandiset_id=dandiset_id,
version='draft',
)

if old_version.status != Version.Status.PUBLISHING:
raise DandisetNotLocked(
'Dandiset must be in PUBLISHING state. Call `_lock_dandiset_for_publishing()` '
Expand Down
5 changes: 0 additions & 5 deletions dandiapi/api/tasks/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from celery import shared_task
from celery.utils.log import get_task_logger
from django.db.transaction import atomic

from dandiapi.api.doi import delete_doi
from dandiapi.api.manifests import (
Expand Down Expand Up @@ -33,7 +32,6 @@ def calculate_sha256(blob_id: str) -> None:


@shared_task(soft_time_limit=180)
@atomic
def write_manifest_files(version_id: int) -> None:
version: Version = Version.objects.get(id=version_id)
logger.info('Writing manifests for version %s:%s', version.dandiset.identifier, version.version)
Expand All @@ -46,7 +44,6 @@ def write_manifest_files(version_id: int) -> None:


@shared_task(soft_time_limit=10)
@atomic
def validate_asset_metadata_task(asset_id: int) -> None:
from dandiapi.api.services.metadata import validate_asset_metadata

Expand All @@ -56,7 +53,6 @@ def validate_asset_metadata_task(asset_id: int) -> None:


@shared_task(soft_time_limit=30)
@atomic
def validate_version_metadata_task(version_id: int) -> None:
from dandiapi.api.services.metadata import validate_version_metadata

Expand All @@ -78,7 +74,6 @@ def unembargo_dandiset_task(dandiset_id: int):


@shared_task
@atomic
def publish_dandiset_task(dandiset_id: int):
from dandiapi.api.services.publish import _publish_dandiset

Expand Down

0 comments on commit dec4409

Please sign in to comment.