Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate dandiset unembargo #1965

Merged
merged 9 commits into from
Jul 22, 2024
Merged

Automate dandiset unembargo #1965

merged 9 commits into from
Jul 22, 2024

Conversation

jjnesbitt
Copy link
Member

@jjnesbitt jjnesbitt commented Jul 2, 2024

This automates the new unembargo workflow introduced in #1890. Now, when a dandiset unembargo is kicked off from the API, the unembargo task will immediately be put on the worker queue. If that task fails, both the devs and dandiset owners will be notified through an email, as well as through sentry. There's no retrying implemented for the dandiset unembargo task, as my thinking is that retrying an unknown error would simply cause the error to fail further. Instead, I think we should simply investigate and directly resolve any errors we might find.

The only qualm I have with this at the moment is that I wasn't able to find a good way to test that the desired email is sent when the dandiset unembargo task fails. I can test this myself locally when running the application in dev mode, but doing so in a testing context has proved more difficult, as it seems that either the on_failure hook isn't called, or the custom Task class isn't used at all. @mvandenburgh @danlamanna if you have any ideas here I'd be interested. This has been addressed.

@jjnesbitt jjnesbitt requested a review from waxlamp July 2, 2024 22:17
dandiapi/api/services/embargo/__init__.py Outdated Show resolved Hide resolved
dandiapi/api/services/embargo/__init__.py Outdated Show resolved Hide resolved
dandiapi/api/services/embargo/__init__.py Outdated Show resolved Hide resolved
dandiapi/api/services/embargo/__init__.py Outdated Show resolved Hide resolved
dandiapi/api/services/embargo/__init__.py Show resolved Hide resolved
dandiapi/api/services/embargo/__init__.py Show resolved Hide resolved
dandiapi/api/services/embargo/__init__.py Show resolved Hide resolved
dandiapi/api/models/dandiset.py Show resolved Hide resolved
Comment on lines 46 to 53
def build_message( # noqa: PLR0913
to: list[str],
subject: str,
message: str,
html_message: str | None = None,
cc: list[str] | None = None,
bcc: list[str] | None = None,
):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if this PR is the place for it, but since you've altered this function already: I wonder if this function would be better off with keyword-only arguments. That would make the use of the function elsewhere much clearer at a glance.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is honestly pretty superfluous, as it simply wraps the construction of a mail.EmailMultiAlternatives class instance. I think it'd be better to remove it entirely.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll file an issue for this.

@jjnesbitt jjnesbitt added patch Increment the patch version when merged embargo Issues around embargo functionality release Create a release when this pr is merged labels Jul 22, 2024
@jjnesbitt jjnesbitt merged commit 984192c into master Jul 22, 2024
11 checks passed
@jjnesbitt jjnesbitt deleted the automated-unembargo branch July 22, 2024 18:14
@dandibot
Copy link
Member

🚀 PR was released in v0.3.90 🚀

@dandibot dandibot added the released This issue/pull request has been released. label Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
embargo Issues around embargo functionality patch Increment the patch version when merged release Create a release when this pr is merged released This issue/pull request has been released.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants