Is there a way to stop all registered schedules?

In Redash v4, there are about 500 scheduled configurations that are working.
Is there any way to stop all of them?
To reduce the load on the database, I want to be able to only view the queries and stop all the scheduled ones.
Thank you in advance.

Wow that’s an old version of Redash! Any reason you haven’t upgraded yet? :wink:

There are a few ways to accomplish this:

  • Disable the scheduler service so that periodic jobs (like scheduled queries) are never enqueued
  • Stop your workers from pulling jobs off the scheduled queue
  • Run a mass update on the metadata database to remove the query schedules entirely
  • Modify the source code so that scheduling queries no longer occurs

I would go with the first or the fourth option. The fourth one is nice because your data source schemas will still refresh, and old query results will still be cleared out of the metadata database. If you go with step 1, your query results cache could grow indefinitely.

Thank you very much.
I know that v4 is old.
And since I haven’t changed to running on docker yet, I’m thinking of changing to v8 and docker environment now.
However, the members have been using v4 for a long time, so I wanted to keep v4 for a limited time just to check the data just in case.
I was thinking of leaving it for viewing only and stopping all schedule execution.

Now, I’d like to try that fourth method, but when you say tweak the source code, you mean change python, right? (Or, I was trying to edit the connection information of the data source to make it fundamentally unreachable.)
In that case, please tell me what to change and what to do to compile it.

You can edit the python by replacing all of this with the word pass.

Or you can make the data sources fundamentally unreachable like you said. But doing this will break them for even users running queries by hand. Which might not be desirable.

I see. Thank you very much.
I see that refresh_query() is in charge of scheduled execution.
When I entered the docker container in v8, I think it contained .pyc, which is probably a compiled python file.

The code I sent you was specifically for V4. It would be different in V8.

I’m sorry, that wasn’t worded well.
When I was touching v8, it seemed to compile as .pyc, so I thought I would need to compile v4 the same way.

Sorry, I have one more question.
I’d like to look at the contents of the function, just to be sure.
Another way to stop the scheduled execution is to use the
as another way to stop scheduled execution.
If this is set to true, the scheduler will not stop, but will keep refresh_schedule() running.
However, if the environment variable is true in refresh_schedule(), the function will break with a message, so the database will not be overloaded.
Isn’t that correct?
In addition to this, I’m thinking of changing the data source settings to completely disconnect the connection.

TIL :smiley:

That would be the best option.