Skip to content
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

Vérifier que le fichier cron.json est correctement trié #4660

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions clevercloud/cron.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
[
"*/5 * * * * $ROOT/clevercloud/status-probes.sh",
"*/5 * * * * $ROOT/clevercloud/run_management_command.sh scan_s3_files",

"*/5 * * * * $ROOT/clevercloud/send_approvals_to_pe.sh",
"*/15 6-16 * * 1-5 $ROOT/clevercloud/run_management_command.sh import_advisor_information shared_bucket/imports-gps/export_gps.xlsx --wet-run",

"5 * * * * $ROOT/clevercloud/run_management_command.sh sync_pec_offers --wet-run",
"5 * * * * $ROOT/clevercloud/run_management_command.sh update_companies_job_app_score",
"10 * * * * $ROOT/clevercloud/run_management_command.sh pe_certify_users --wet-run",
"15 * * * * $ROOT/clevercloud/run_management_command.sh sanitize_employee_records",

"0 * * * * $ROOT/clevercloud/run_management_command.sh resolve_insee_cities --wet-run --mode=companies",
"20 * * * * $ROOT/clevercloud/run_management_command.sh resolve_insee_cities --wet-run --mode=prescribers",
"40 * * * * $ROOT/clevercloud/run_management_command.sh resolve_insee_cities --wet-run --mode=job_seekers",

"25 8-18/2 * * 1-5 $ROOT/clevercloud/transfer_employee_records.sh --download",
"55 8-18/2 * * 1-5 $ROOT/clevercloud/transfer_employee_records.sh --upload",

"0 */6 * * * $ROOT/clevercloud/run_management_command.sh sync_s3_files",

"1 0 * * * $ROOT/clevercloud/run_management_command.sh update_prescriber_organization_with_api_entreprise --verbosity 2",
Expand All @@ -24,10 +27,6 @@
"30 20 * * * $ROOT/clevercloud/crons/populate_metabase_emplois.sh --daily",
"5 23 * * * $ROOT/clevercloud/run_management_command.sh archive_employee_records --wet-run",

"25 8-18/2 * * 1-5 $ROOT/clevercloud/transfer_employee_records.sh --download",
"55 8-18/2 * * 1-5 $ROOT/clevercloud/transfer_employee_records.sh --upload",
"*/15 6-16 * * 1-5 $ROOT/clevercloud/run_management_command.sh import_advisor_information shared_bucket/imports-gps/export_gps.xlsx --wet-run",

"0 0 * * 1 $ROOT/clevercloud/run_management_command.sh shorten_active_sessions",
"0 2 * * 1 $ROOT/clevercloud/crons/populate_metabase_matomo.sh",
"0 12 * * 1 $ROOT/clevercloud/run_management_command.sh import_ea_eatt --from-asp --wet-run",
Expand Down
5 changes: 5 additions & 0 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1125,6 +1125,10 @@ pytest-xdist==3.6.1 \
--hash=sha256:9ed4adfb68a016610848639bb7e02c9352d5d9f03d04809919e2dafc3be4cca7 \
--hash=sha256:ead156a4db231eec769737f57668ef58a2084a34b2e55c4a8fa20d861107300d
# via -r requirements/test.txt
python-crontab==3.2.0 \
--hash=sha256:40067d1dd39ade3460b2ad8557c7651514cd3851deffff61c5c60e1227c5c36b \
--hash=sha256:82cb9b6a312d41ff66fd3caf3eed7115c28c195bfb50711bc2b4b9592feb9fe5
# via -r requirements/test.txt
python-dateutil==2.9.0.post0 \
--hash=sha256:37dd54208da7e1cd875388217d5e00ebd4179249f90fb72437e91a35459a0ad3 \
--hash=sha256:a8b2bc7bffae282281c8140a97d3aa9c14da0b136dfe83f850eea9a5f7470427
Expand All @@ -1134,6 +1138,7 @@ python-dateutil==2.9.0.post0 \
# faker
# freezegun
# pandas
# python-crontab
python-dotenv==1.0.1 \
--hash=sha256:e324ee90a023d808f1959c46bcbc04446a10ced277783dc6ee09987c37ec10ca \
--hash=sha256:f7b63ef50f1b690dddf550d03497b66d609393b40b564ed0d674909a68ebf16a
Expand Down
1 change: 1 addition & 0 deletions requirements/test.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pytest-mock # https://github.com/pytest-dev/pytest-mock/
pytest-randomly # https://github.com/pytest-dev/pytest-randomly
pytest-subtests # https://github.com/pytest-dev/pytest-subtests
pytest-xdist # https://pypi.org/project/pytest-xdist/
python-crontab # https://gitlab.com/doctormo/python-crontab/
unittest-parametrize # https://github.com/adamchainz/unittest-parametrize
# Mock Anymail requests.
requests-mock # https://github.com/jamielennox/requests-mock
Expand Down
5 changes: 5 additions & 0 deletions requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1007,6 +1007,10 @@ pytest-xdist==3.6.1 \
--hash=sha256:9ed4adfb68a016610848639bb7e02c9352d5d9f03d04809919e2dafc3be4cca7 \
--hash=sha256:ead156a4db231eec769737f57668ef58a2084a34b2e55c4a8fa20d861107300d
# via -r requirements/test.in
python-crontab==3.2.0 \
--hash=sha256:40067d1dd39ade3460b2ad8557c7651514cd3851deffff61c5c60e1227c5c36b \
--hash=sha256:82cb9b6a312d41ff66fd3caf3eed7115c28c195bfb50711bc2b4b9592feb9fe5
# via -r requirements/test.in
python-dateutil==2.9.0.post0 \
--hash=sha256:37dd54208da7e1cd875388217d5e00ebd4179249f90fb72437e91a35459a0ad3 \
--hash=sha256:a8b2bc7bffae282281c8140a97d3aa9c14da0b136dfe83f850eea9a5f7470427
Expand All @@ -1016,6 +1020,7 @@ python-dateutil==2.9.0.post0 \
# faker
# freezegun
# pandas
# python-crontab
python-dotenv==1.0.1 \
--hash=sha256:e324ee90a023d808f1959c46bcbc04446a10ced277783dc6ee09987c37ec10ca \
--hash=sha256:f7b63ef50f1b690dddf550d03497b66d609393b40b564ed0d674909a68ebf16a
Expand Down
17 changes: 17 additions & 0 deletions tests/test_consistency.py
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
Loading