-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: rearrangement des tâches planifiées (#931)
## Description 🎸 ré-arrangement des tâches planifiées par fréquence > heure > minute 🧑🍳 la fréquence est le nombre d'executions attendues dans une année 🛸 ajout de la lib `python-crontab` ## Type de changement 🚧 technique ### Points d'attention 🦺 ajout d'un test sur l'arrangement des tâches dans `cron.json` 🦺 thks to @rsebille
- Loading branch information
1 parent
48b5cec
commit af0147d
Showing
4 changed files
with
39 additions
and
7 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
[ | ||
"*/10 * * * * $ROOT/clevercloud/rebuild_index.sh", | ||
"*/15 7-21 * * * $ROOT/clevercloud/run_management_command.sh send_messages_notifications asap", | ||
"10 6-22 * * * $ROOT/clevercloud/run_management_command.sh add_user_to_list_when_register", | ||
"55 8-18 * * 1-5 $ROOT/clevercloud/run_management_command.sh add_missyou_notifications", | ||
"0 3 * * * $ROOT/clevercloud/run_management_command.sh clearsessions", | ||
"20 6 * * * $ROOT/clevercloud/run_management_command.sh send_messages_notifications day", | ||
"0 11 * * * $ROOT/clevercloud/run_management_command.sh collect_matomo_stats", | ||
"5 11 * * * $ROOT/clevercloud/run_management_command.sh collect_django_stats", | ||
"10 11 1 * * $ROOT/clevercloud/run_management_command.sh collect_matomo_stats --period month", | ||
"2 12 * * * $ROOT/clevercloud/run_management_command.sh datas_anonymisation", | ||
"30 13 * * 1-5 $ROOT/clevercloud/run_management_command.sh send_notifs_on_unanswered_topics", | ||
"15 11 * * 1 $ROOT/clevercloud/run_management_command.sh collect_matomo_forum_stats", | ||
"*/15 7-21 * * * $ROOT/clevercloud/run_management_command.sh send_messages_notifications asap", | ||
"55 8-18 * * 1-5 $ROOT/clevercloud/run_management_command.sh add_missyou_notifications", | ||
"20 6 * * * $ROOT/clevercloud/run_management_command.sh send_messages_notifications day", | ||
"10 6-22 * * * $ROOT/clevercloud/run_management_command.sh add_user_to_list_when_register", | ||
"0 12 * * 1 $ROOT/clevercloud/run_management_command.sh delete_old_email_sent_tracks", | ||
"2 12 * * * $ROOT/clevercloud/run_management_command.sh datas_anonymisation", | ||
"30 13 * * 1-5 $ROOT/clevercloud/run_management_command.sh send_notifs_on_unanswered_topics" | ||
"10 11 1 * * $ROOT/clevercloud/run_management_command.sh collect_matomo_stats --period month" | ||
] |
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,17 @@ | ||
import json | ||
import pathlib | ||
|
||
from crontab import CronTab | ||
|
||
|
||
def test_crontab_order(settings): | ||
current_jobs = list( | ||
CronTab( | ||
tab="\n".join( | ||
json.loads(pathlib.Path(settings.ROOT_DIR).joinpath("clevercloud", "cron.json").read_bytes()) | ||
) | ||
) | ||
) | ||
ordered_jobs = sorted(current_jobs, key=lambda j: (-j.frequency(), j.hour.parts, j.minute.parts)) | ||
|
||
assert ordered_jobs == current_jobs |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.