mozilla / redash

This is a Mozilla fork of the re:dash project (https://redash.io/), where we do work to be contributed back to the upstream project and for our own custom needs.
BSD 2-Clause "Simplified" License
20 stars 21 forks source link

Mandatory expiry of scheduled queries #982

Open emtwo opened 5 years ago

emtwo commented 5 years ago

As suggested in https://github.com/mozilla/redash/issues/949, scheduled queries are often forgotten so it might be helpful to automatically expire them after some time unless they are renewed.

jezdez commented 5 years ago

FWIW we already can set up periodic Celery tasks via redash-stmo and the extension mechanism.

So I suggest to have two things:

Add a task to go through all scheduled queries (maybe in a staggered way) and look how long they've been running. When they reach a schedule timeout (e.g. after 30 days for daily queries, after 2 months for bi-weekly queries, quarterly for monthly jobs, yearly for yearly queries) we reset the scheduling.

And then send out notifications to their owners asking to either confirm the scheduling by clicking a link in the email that would reinstate the schedule or doing nothing.

In the extension we can add new API endpoints, and even static Flask views that render an output when the users have clicked on the link.

wlach commented 5 years ago

It would be nice if there were some integration between the expiry notifications and the "ends on" field described here:

https://github.com/mozilla/redash/issues/949#issuecomment-490853091

Having two seperate expiry policies (one displayed in the UI, the other only enforced via a celery task) might be a bit confusing to people. If it were up to me, I'd probably modify the UI above to insist that queries expire after a maximum period of time. A celery task could then warn the user when that date is close to arriving.