-
Notifications
You must be signed in to change notification settings - Fork 12
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
Conversation
5700a0c
to
7721459
Compare
c4bde3b
to
8fefb57
Compare
8fefb57
to
bc1be9b
Compare
dandiapi/api/mail.py
Outdated
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, | ||
): |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
🚀 PR was released in |
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 theThis has been addressed.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.