From 492b48c311ac4b8faac9f2e84a6e9d249f59d2b6 Mon Sep 17 00:00:00 2001 From: Jacob Nesbitt Date: Tue, 18 Jun 2024 16:42:46 -0400 Subject: [PATCH] Fix spelling of "unembargo" --- dandiapi/api/mail.py | 10 ++++------ dandiapi/api/migrations/0008_migrate_embargoed_data.py | 2 +- dandiapi/api/services/asset/__init__.py | 4 ++-- dandiapi/api/services/dandiset/__init__.py | 4 ++-- dandiapi/api/services/embargo/__init__.py | 2 +- dandiapi/api/services/embargo/exceptions.py | 6 +++--- dandiapi/api/tasks/scheduled.py | 4 ++-- .../api/templates/api/mail/dandiset_unembargoed.html | 2 +- .../api/templates/api/mail/dandisets_to_unembargo.txt | 2 +- dandiapi/api/tests/test_asset.py | 2 +- dandiapi/api/tests/test_dandiset.py | 4 ++-- dandiapi/api/tests/test_unembargo.py | 2 +- dandiapi/api/views/asset.py | 8 ++++---- dandiapi/api/views/dandiset.py | 4 ++-- dandiapi/api/views/upload.py | 6 +++--- dandiapi/api/views/version.py | 4 ++-- doc/design/embargo-redesign.md | 10 +++++----- .../views/DandisetLandingView/DandisetUnembargo.vue | 4 ++-- 18 files changed, 39 insertions(+), 41 deletions(-) diff --git a/dandiapi/api/mail.py b/dandiapi/api/mail.py index 9f05acdb5..d68395d69 100644 --- a/dandiapi/api/mail.py +++ b/dandiapi/api/mail.py @@ -194,14 +194,14 @@ def build_dandisets_to_unembargo_message(dandisets: Iterable[Dandiset]): ] render_context = {**BASE_RENDER_CONTEXT, 'dandisets': dandiset_context} return build_message( - subject='DANDI: New Dandisets to un-embargo', + subject='DANDI: New Dandisets to unembargo', message=render_to_string('api/mail/dandisets_to_unembargo.txt', render_context), to=[settings.DANDI_DEV_EMAIL], ) def send_dandisets_to_unembargo_message(dandisets: Iterable[Dandiset]): - logger.info('Sending dandisets to un-embargo message to devs at %s', settings.DANDI_DEV_EMAIL) + logger.info('Sending dandisets to unembargo message to devs at %s', settings.DANDI_DEV_EMAIL) messages = [build_dandisets_to_unembargo_message(dandisets)] with mail.get_connection() as connection: connection.send_messages(messages) @@ -219,7 +219,7 @@ def build_dandiset_unembargoed_message(dandiset: Dandiset): } html_message = render_to_string('api/mail/dandiset_unembargoed.html', render_context) return build_message( - subject='Your Dandiset has been un-embargoed!', + subject='Your Dandiset has been unembargoed!', message=strip_tags(html_message), html_message=html_message, to=[owner.email for owner in dandiset.owners], @@ -227,9 +227,7 @@ def build_dandiset_unembargoed_message(dandiset: Dandiset): def send_dandiset_unembargoed_message(dandiset: Dandiset): - logger.info( - 'Sending dandisets un-embargoed message to dandiset %s owners.', dandiset.identifier - ) + logger.info('Sending dandisets unembargoed message to dandiset %s owners.', dandiset.identifier) messages = [build_dandiset_unembargoed_message(dandiset)] with mail.get_connection() as connection: connection.send_messages(messages) diff --git a/dandiapi/api/migrations/0008_migrate_embargoed_data.py b/dandiapi/api/migrations/0008_migrate_embargoed_data.py index 13943aeaf..d454fe3fb 100644 --- a/dandiapi/api/migrations/0008_migrate_embargoed_data.py +++ b/dandiapi/api/migrations/0008_migrate_embargoed_data.py @@ -21,7 +21,7 @@ def migrate_embargoed_blob(embargoed_blob): # as the above case, but between an embargoed and open dandiset, instead of two # embargoed dandisets. # - # In case #3, the asset will effectively be un-embargoed. + # In case #3, the asset will effectively be unembargoed. existing_blob = AssetBlob.objects.filter( etag=embargoed_blob.etag, size=embargoed_blob.size ).first() diff --git a/dandiapi/api/services/asset/__init__.py b/dandiapi/api/services/asset/__init__.py index 6c0ee60ed..4e75048b3 100644 --- a/dandiapi/api/services/asset/__init__.py +++ b/dandiapi/api/services/asset/__init__.py @@ -136,7 +136,7 @@ def add_asset_to_version( raise ZarrArchiveBelongsToDifferentDandisetError # Creating an asset in an OPEN dandiset that points to an embargoed blob results in that - # blob being un-embargoed + # blob being unembargoed unembargo_asset_blob = ( asset_blob is not None and asset_blob.embargoed @@ -159,7 +159,7 @@ def add_asset_to_version( version.save() # Perform this after the above transaction has finished, to ensure we only operate on - # un-embargoed asset blobs + # unembargoed asset blobs if asset_blob and unembargo_asset_blob: remove_asset_blob_embargoed_tag_task.delay(blob_id=asset_blob.blob_id) diff --git a/dandiapi/api/services/dandiset/__init__.py b/dandiapi/api/services/dandiset/__init__.py index 2159c9dbd..05450a94f 100644 --- a/dandiapi/api/services/dandiset/__init__.py +++ b/dandiapi/api/services/dandiset/__init__.py @@ -5,7 +5,7 @@ from dandiapi.api.models.dandiset import Dandiset from dandiapi.api.models.version import Version from dandiapi.api.services.dandiset.exceptions import DandisetAlreadyExistsError -from dandiapi.api.services.embargo.exceptions import DandisetUnEmbargoInProgressError +from dandiapi.api.services.embargo.exceptions import DandisetUnembargoInProgressError from dandiapi.api.services.exceptions import AdminOnlyOperationError, NotAllowedError from dandiapi.api.services.version.metadata import _normalize_version_metadata @@ -57,7 +57,7 @@ def delete_dandiset(*, user, dandiset: Dandiset) -> None: if dandiset.versions.filter(status=Version.Status.PUBLISHING).exists(): raise NotAllowedError('Cannot delete dandisets that are currently being published.') if dandiset.embargo_status == Dandiset.EmbargoStatus.UNEMBARGOING: - raise DandisetUnEmbargoInProgressError + raise DandisetUnembargoInProgressError # Delete all versions first, so that AssetPath deletion is cascaded # through versions, rather than through zarrs directly diff --git a/dandiapi/api/services/embargo/__init__.py b/dandiapi/api/services/embargo/__init__.py index 954f96098..c4bcf89a3 100644 --- a/dandiapi/api/services/embargo/__init__.py +++ b/dandiapi/api/services/embargo/__init__.py @@ -83,7 +83,7 @@ def unembargo_dandiset(*, user: User, dandiset: Dandiset): raise DandisetActiveUploadsError # A scheduled task will pick up any new dandisets with this status and email the admins to - # initiate the un-embargo process + # initiate the unembargo process dandiset.embargo_status = Dandiset.EmbargoStatus.UNEMBARGOING dandiset.save() diff --git a/dandiapi/api/services/embargo/exceptions.py b/dandiapi/api/services/embargo/exceptions.py index 351522269..13038bd59 100644 --- a/dandiapi/api/services/embargo/exceptions.py +++ b/dandiapi/api/services/embargo/exceptions.py @@ -17,12 +17,12 @@ class DandisetNotEmbargoedError(DandiError): class DandisetActiveUploadsError(DandiError): http_status_code = status.HTTP_400_BAD_REQUEST - message = 'Dandiset un-embargo not allowed with active uploads' + message = 'Dandiset unembargo not allowed with active uploads' -class DandisetUnEmbargoInProgressError(DandiError): +class DandisetUnembargoInProgressError(DandiError): http_status_code = status.HTTP_400_BAD_REQUEST - message = 'Dandiset modification not allowed during un-embargo' + message = 'Dandiset modification not allowed during unembargo' class UnauthorizedEmbargoAccessError(DandiError): diff --git a/dandiapi/api/tasks/scheduled.py b/dandiapi/api/tasks/scheduled.py index bba10340d..9fa8af71d 100644 --- a/dandiapi/api/tasks/scheduled.py +++ b/dandiapi/api/tasks/scheduled.py @@ -114,7 +114,7 @@ def send_pending_users_email() -> None: @shared_task(soft_time_limit=20) def send_dandisets_to_unembargo_email() -> None: - """Send an email to admins listing dandisets that have requested un-embargo.""" + """Send an email to admins listing dandisets that have requested unembargo.""" dandisets = Dandiset.objects.filter(embargo_status=Dandiset.EmbargoStatus.UNEMBARGOING) if dandisets.exists(): send_dandisets_to_unembargo_message(dandisets) @@ -148,7 +148,7 @@ def register_scheduled_tasks(sender: Celery, **kwargs): # Send daily email to admins containing a list of users awaiting approval sender.add_periodic_task(crontab(hour=0, minute=0), send_pending_users_email.s()) - # Send daily email to admins containing a list of dandisets to un-embargo + # Send daily email to admins containing a list of dandisets to unembargo sender.add_periodic_task(crontab(hour=0, minute=0), send_dandisets_to_unembargo_email.s()) # Refresh the materialized view used by asset search every 10 mins. diff --git a/dandiapi/api/templates/api/mail/dandiset_unembargoed.html b/dandiapi/api/templates/api/mail/dandiset_unembargoed.html index 978dea42f..236a5281b 100644 --- a/dandiapi/api/templates/api/mail/dandiset_unembargoed.html +++ b/dandiapi/api/templates/api/mail/dandiset_unembargoed.html @@ -1,4 +1,4 @@ -Dandiset {{ dandiset.identifier }} has been un-embargoed, and is now open for +Dandiset {{ dandiset.identifier }} has been unembargoed, and is now open for public access.

You are receiving this email because you are an owner of this dandiset. diff --git a/dandiapi/api/templates/api/mail/dandisets_to_unembargo.txt b/dandiapi/api/templates/api/mail/dandisets_to_unembargo.txt index 3676f7721..c716839b1 100644 --- a/dandiapi/api/templates/api/mail/dandisets_to_unembargo.txt +++ b/dandiapi/api/templates/api/mail/dandisets_to_unembargo.txt @@ -1,5 +1,5 @@ {% autoescape off %} -The following new dandisets are awaiting un-embargo: +The following new dandisets are awaiting unembargo: {% for ds in dandisets %} Dandiset ID: {{ ds.identifier }} diff --git a/dandiapi/api/tests/test_asset.py b/dandiapi/api/tests/test_asset.py index 1da6a32c3..68dadca42 100644 --- a/dandiapi/api/tests/test_asset.py +++ b/dandiapi/api/tests/test_asset.py @@ -670,7 +670,7 @@ def test_asset_create_embargoed_asset_blob_open_dandiset( api_client, user, draft_version, embargoed_asset_blob, mocker ): # Ensure that creating an asset in an open dandiset that points to an embargoed asset blob - # results in that asset blob being un-embargoed + # results in that asset blob being unembargoed assert draft_version.dandiset.embargo_status == Dandiset.EmbargoStatus.OPEN assert embargoed_asset_blob.embargoed diff --git a/dandiapi/api/tests/test_dandiset.py b/dandiapi/api/tests/test_dandiset.py index 18cc1adb1..9efeed612 100644 --- a/dandiapi/api/tests/test_dandiset.py +++ b/dandiapi/api/tests/test_dandiset.py @@ -751,7 +751,7 @@ def test_dandiset_rest_delete(api_client, draft_version_factory, user): assert response.status_code == 204 assert not Dandiset.objects.all() - # Ensure that currently un-embargoing dandisets can't be deleted + # Ensure that currently unembargoing dandisets can't be deleted draft_version = draft_version_factory( dandiset__embargo_status=Dandiset.EmbargoStatus.UNEMBARGOING ) @@ -891,7 +891,7 @@ def test_dandiset_rest_change_owners_unembargoing( user_factory, social_account_factory, ): - """Test that un-embargoing a dandiset prevents user modification.""" + """Test that unembargoing a dandiset prevents user modification.""" draft_version = draft_version_factory( dandiset__embargo_status=Dandiset.EmbargoStatus.UNEMBARGOING ) diff --git a/dandiapi/api/tests/test_unembargo.py b/dandiapi/api/tests/test_unembargo.py index dae007551..b4976d832 100644 --- a/dandiapi/api/tests/test_unembargo.py +++ b/dandiapi/api/tests/test_unembargo.py @@ -36,7 +36,7 @@ def test_unembargo_dandiset_sends_emails( send_dandisets_to_unembargo_email() assert mailoutbox - assert 'un-embargo' in mailoutbox[0].subject + assert 'unembargo' in mailoutbox[0].subject assert dandiset.identifier in mailoutbox[0].message().get_payload() assert user.username in mailoutbox[0].message().get_payload() diff --git a/dandiapi/api/views/asset.py b/dandiapi/api/views/asset.py index 549ce113a..d92fa0d0e 100644 --- a/dandiapi/api/views/asset.py +++ b/dandiapi/api/views/asset.py @@ -9,7 +9,7 @@ remove_asset_from_version, ) from dandiapi.api.services.asset.exceptions import DraftDandisetNotModifiableError -from dandiapi.api.services.embargo.exceptions import DandisetUnEmbargoInProgressError +from dandiapi.api.services.embargo.exceptions import DandisetUnembargoInProgressError from dandiapi.zarr.models import ZarrArchive try: @@ -325,7 +325,7 @@ def create(self, request, versions__dandiset__pk, versions__version): ) if version.dandiset.embargo_status == Dandiset.EmbargoStatus.UNEMBARGOING: - raise DandisetUnEmbargoInProgressError + raise DandisetUnembargoInProgressError serializer = AssetRequestSerializer(data=self.request.data) serializer.is_valid(raise_exception=True) @@ -362,7 +362,7 @@ def update(self, request, versions__dandiset__pk, versions__version, **kwargs): if version.version != 'draft': raise DraftDandisetNotModifiableError if version.dandiset.embargo_status == Dandiset.EmbargoStatus.UNEMBARGOING: - raise DandisetUnEmbargoInProgressError + raise DandisetUnembargoInProgressError serializer = AssetRequestSerializer(data=self.request.data) serializer.is_valid(raise_exception=True) @@ -400,7 +400,7 @@ def destroy(self, request, versions__dandiset__pk, versions__version, **kwargs): version=versions__version, ) if version.dandiset.embargo_status == Dandiset.EmbargoStatus.UNEMBARGOING: - raise DandisetUnEmbargoInProgressError + raise DandisetUnembargoInProgressError # Lock asset for delete with transaction.atomic(): diff --git a/dandiapi/api/views/dandiset.py b/dandiapi/api/views/dandiset.py index 50d693bfc..d202cc11f 100644 --- a/dandiapi/api/views/dandiset.py +++ b/dandiapi/api/views/dandiset.py @@ -27,7 +27,7 @@ from dandiapi.api.services.dandiset import create_dandiset, delete_dandiset from dandiapi.api.services.embargo import unembargo_dandiset from dandiapi.api.services.embargo.exceptions import ( - DandisetUnEmbargoInProgressError, + DandisetUnembargoInProgressError, UnauthorizedEmbargoAccessError, ) from dandiapi.api.views.common import DANDISET_PK_PARAM @@ -378,7 +378,7 @@ def users(self, request, dandiset__pk): # noqa: C901 dandiset: Dandiset = self.get_object() if request.method == 'PUT': if dandiset.embargo_status == Dandiset.EmbargoStatus.UNEMBARGOING: - raise DandisetUnEmbargoInProgressError + raise DandisetUnembargoInProgressError # Verify that the user is currently an owner response = get_40x_or_None(request, ['owner'], dandiset, return_403=True) diff --git a/dandiapi/api/views/upload.py b/dandiapi/api/views/upload.py index 7ef0aa0bd..acdf6a41e 100644 --- a/dandiapi/api/views/upload.py +++ b/dandiapi/api/views/upload.py @@ -17,7 +17,7 @@ from dandiapi.api.models import AssetBlob, Dandiset, Upload from dandiapi.api.permissions import IsApproved -from dandiapi.api.services.embargo.exceptions import DandisetUnEmbargoInProgressError +from dandiapi.api.services.embargo.exceptions import DandisetUnembargoInProgressError from dandiapi.api.tasks import calculate_sha256 from dandiapi.api.views.serializers import AssetBlobSerializer @@ -136,9 +136,9 @@ def upload_initialize_view(request: Request) -> HttpResponseBase: if response: return response - # Ensure dandiset not in the process of un-embargo + # Ensure dandiset not in the process of unembargo if dandiset.embargo_status == Dandiset.EmbargoStatus.UNEMBARGOING: - raise DandisetUnEmbargoInProgressError + raise DandisetUnembargoInProgressError logging.info( 'Starting upload initialization of size %s, ETag %s to dandiset %s', diff --git a/dandiapi/api/views/version.py b/dandiapi/api/views/version.py index 7ef74d9ed..0a052d9a7 100644 --- a/dandiapi/api/views/version.py +++ b/dandiapi/api/views/version.py @@ -14,7 +14,7 @@ from rest_framework_extensions.mixins import DetailSerializerMixin, NestedViewSetMixin from dandiapi.api.models import Dandiset, Version -from dandiapi.api.services.embargo.exceptions import DandisetUnEmbargoInProgressError +from dandiapi.api.services.embargo.exceptions import DandisetUnembargoInProgressError from dandiapi.api.services.publish import publish_dandiset from dandiapi.api.tasks import delete_doi_task from dandiapi.api.views.common import DANDISET_PK_PARAM, VERSION_PARAM @@ -96,7 +96,7 @@ def update(self, request, **kwargs): status=status.HTTP_405_METHOD_NOT_ALLOWED, ) if version.dandiset.embargo_status == Dandiset.EmbargoStatus.UNEMBARGOING: - raise DandisetUnEmbargoInProgressError + raise DandisetUnembargoInProgressError serializer = VersionMetadataSerializer(data=request.data) serializer.is_valid(raise_exception=True) diff --git a/doc/design/embargo-redesign.md b/doc/design/embargo-redesign.md index 754395afc..d3e783c2b 100644 --- a/doc/design/embargo-redesign.md +++ b/doc/design/embargo-redesign.md @@ -71,9 +71,9 @@ sequenceDiagram end ``` -## Change to Un-Embargo Procedure +## Change to Unembargo Procedure -Once the time comes to *********un-embargo********* those files, all that is required is to remove the `embargoed` tag from all of the objects. This can be achieved by an [S3 Batch Operations Job](https://docs.aws.amazon.com/AmazonS3/latest/userguide/batch-ops-create-job.html), in which the list of files is specified (all files belonging to the dandiset), and the desired action is specified (delete/replace tags). +Once the time comes to *********unembargo********* those files, all that is required is to remove the `embargoed` tag from all of the objects. This can be achieved by an [S3 Batch Operations Job](https://docs.aws.amazon.com/AmazonS3/latest/userguide/batch-ops-create-job.html), in which the list of files is specified (all files belonging to the dandiset), and the desired action is specified (delete/replace tags). The benefit of this approach is that once the files are uploaded, no further movement is required to change the embargo state, eliminating the storage, egress, and time costs associated with unembargoing from a second bucket. Using S3 Batch Operations to perform the untagging also means we can rely on AWS’s own error reporting mechanisms, while retrying any failed operations requires only minimal engineering effort within the Archive codebase. @@ -85,7 +85,7 @@ The benefit of this approach is that once the files are uploaded, no further mov 4. If there are no failures, the Job ID is set to null in the DB model, and the embargo status, metadata, etc. is updated to reflect that the dandiset is now `OPEN`. 5. Otherwise, an exception is raised and attended to by the developers. -A diagram of the un-embargo procedure (pertaining to just the objects) is shown below +A diagram of the unembargo procedure (pertaining to just the objects) is shown below ```mermaid sequenceDiagram @@ -95,8 +95,8 @@ sequenceDiagram participant Worker participant S3 - Client ->> Server: Un-embargo dandiset - Server ->> Worker: Dispatch un-embargo task + Client ->> Server: Unembargo dandiset + Server ->> Worker: Dispatch unembargo task Worker ->> S3: List of all dandiset objects are aggregated into a manifest Worker ->> S3: S3 Batch Operation job created S3 ->> Worker: Job ID is returned diff --git a/web/src/views/DandisetLandingView/DandisetUnembargo.vue b/web/src/views/DandisetLandingView/DandisetUnembargo.vue index 516f3cf77..c6c846a80 100644 --- a/web/src/views/DandisetLandingView/DandisetUnembargo.vue +++ b/web/src/views/DandisetLandingView/DandisetUnembargo.vue @@ -17,11 +17,11 @@ - This action will un-embargo this dandiset. Note that this is a + This action will unembargo this dandiset. Note that this is a permanent - action and cannot be undone. Once a dandiset has been un-embargoed, + action and cannot be undone. Once a dandiset has been unembargoed, it cannot be re-embargoed.

Note: this may take several days to complete.