forked from getredash/redash
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Celery task to clear schedule was added (getredash#3801)
* Celery task to clear schedule was added * fix formating * empty_schedules task was put in separate task * worker interval changed, new tests added * past artifact deleted * test queries moved to right class, lambda was used to filter data * unnecessary changes eliminated * more unnecessary files deleted * line shortened * Line shortened more * codeclimate changes * Unused test deleted, logs added
- Loading branch information
Showing
6 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
from .general import record_event, version_check, send_mail, sync_user_details | ||
from .queries import QueryTask, refresh_queries, refresh_schemas, cleanup_query_results, execute_query | ||
from .queries import QueryTask, refresh_queries, refresh_schemas, cleanup_query_results, execute_query, empty_schedules | ||
from .alerts import check_alerts_for_query |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import datetime | ||
from mock import patch | ||
from tests import BaseTestCase | ||
from redash.tasks import empty_schedules | ||
from redash.models import Query | ||
from redash.utils import utcnow | ||
|
||
|
||
class TestEmptyScheduleQuery(BaseTestCase): | ||
def test_empty_schedules(self): | ||
one_day_ago = (utcnow() - datetime.timedelta(days=1)).strftime("%Y-%m-%d") | ||
query = self.factory.create_query(schedule={'interval':'3600','until':one_day_ago}) | ||
oq = staticmethod(lambda: [query]) | ||
with patch.object(Query, 'past_scheduled_queries', oq): | ||
empty_schedules() | ||
self.assertEqual(query.schedule, None) |