Skip to content

Commit

Permalink
Register and schedule email_actions_to_units flow
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentAntoine committed Aug 16, 2024
1 parent 710f709 commit dedb2de
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
6 changes: 6 additions & 0 deletions datascience/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,9 @@ PREFECT_SERVER_URL=

# data.gouv.fr
DATAGOUV_API_KEY=

# Test modes
IS_INTEGRATION=
TEST_MODE=
PNO_TEST_MODE=
WEEKLY_CONTROL_REPORT_EMAIL_TEST_MODE=
11 changes: 11 additions & 0 deletions datascience/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,17 @@
"y",
)

# Must be set to true to send prior notifications to the FMC, and
# not to real addressees (control units)
WEEKLY_CONTROL_REPORT_EMAIL_TEST_MODE = os.getenv(
"WEEKLY_CONTROL_REPORT_EMAIL_TEST_MODE", "False"
).lower() in (
"true",
"t",
"yes",
"y",
)

# Flow execution configuration
DOCKER_IMAGE = "docker.pkg.github.com/mtes-mct/monitorfish/monitorfish-pipeline"
MONITORFISH_VERSION = os.getenv("MONITORFISH_VERSION")
Expand Down
16 changes: 16 additions & 0 deletions datascience/src/pipeline/flows_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
PNO_TEST_MODE,
ROOT_DIRECTORY,
TEST_MODE,
WEEKLY_CONTROL_REPORT_EMAIL_TEST_MODE,
)
from src.pipeline.flows import (
admin_areas,
Expand All @@ -32,6 +33,7 @@
current_segments,
distribute_pnos,
districts,
email_actions_to_units,
enrich_logbook,
enrich_positions,
facade_areas,
Expand Down Expand Up @@ -88,6 +90,19 @@
),
]
)
email_actions_to_units.flow.schedule = Schedule(
clocks=[
clocks.CronClock(
"0 5 * * 1",
parameter_defaults={
"start_days_ago": 7,
"end_days_ago": 1,
"test_mode": WEEKLY_CONTROL_REPORT_EMAIL_TEST_MODE,
"is_integration": IS_INTEGRATION,
},
),
]
)
enrich_logbook.flow.schedule = Schedule(
clocks=[
clocks.CronClock(
Expand Down Expand Up @@ -299,6 +314,7 @@
current_segments.flow,
distribute_pnos.flow,
districts.flow,
email_actions_to_units.flow,
enrich_logbook.flow,
enrich_positions.flow,
logbook.flow,
Expand Down

0 comments on commit dedb2de

Please sign in to comment.