Edit Order Notification ECS Task¶
Dependencies¶
Configuration (from config service)¶
Attribute |
Description |
|---|---|
storepick-edit-order-notification.json |
Edit Order Notification application configuration |
Variables in Edit Order Notification application config:
Variable |
Use |
|---|---|
EON_LOGGING_CONFIG.disable_existing_loggers |
Must be included and set to false so that all logs are shown and loggers do not overwrite each other |
EON_LOGGING_CONFIG.formatters.monitoring |
Must have the value shown below in order for metric monitoring (e.g. datadog to run correctly if used) |
DATASET and TABLE |
These values together connected with a . should be the equivalent of that shown in: Big Query Cutoff Time Tomorrow View |
REPORT_TABLE |
Should match what is shown in: Big Query Report |
EMAIL_TEMPLATE_ID |
Decides the email format sent to customers, see here: Marketing v2 Template |
SMS_MESSAGE |
The exact text that is sent by sms to the customers |
The expected storepick-edit-order-notification.json file:
{
"TEST_REPORT": true,
"MORI_CONFIG": {},
"EON_LOGGING_CONFIG": {
"disable_existing_loggers": false,
"version": 1,
"formatters": {
"simple": {
"format": "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
},
"monitoring": {
"format": "MONITORING|%(created)f|%(message)s"
}
},
"handlers": {
"console": {
"class": "logging.StreamHandler",
"level": "DEBUG",
"formatter": "simple",
"stream": "ext://sys.stdout"
},
"monitoring": {
"class": "logging.StreamHandler",
"level": "DEBUG",
"formatter": "monitoring",
"stream": "ext://sys.stdout"
}
},
"loggers": {
"monitoring": {
"level": "DEBUG",
"handlers": [
"monitoring"
],
"propagate": false,
"formatter": "monitoring"
},
"console": {
"level": "DEBUG",
"handlers": [
"console"
],
"propagate": false
}
},
"root": {
"level": "DEBUG",
"handlers": [
"console"
]
}
},
"DATASET": "mrw-prod-storepick",
"TABLE": "store_pick_views.edit_cutoff_time_tomorrow",
"REPORT_TABLE": "mrw-prod-storepick.store_pick.Edit_Order_Notification_Report",
"MORI_BASE_URL": "https://api.morrisons.com",
"CUSTOMER_URL": "customer/v2/customers",
"MARKETINGEMAIL_URL": "marketing/v2/channels/email",
"MARKETING_URL": "marketing/v2/channels",
"MARKETINGSMS_URL": "marketing/v2/channels/sms",
"EMAIL_TEMPLATE_ID": "8080221",
"SMS_MESSAGE": "Your Morrisons delivery is tomorrow. Forgotten something? You can make last minute changes to your order until 23:30 today."
}
ECS Task¶
Exceptions¶
Sequence Diagram¶
Functions¶
-
ecstask.main.run_application()[source]¶ The main method to run the application.
Initialises dependencies class to retrieve google credentials for big query and application config.
Retrieves order and customer id’s for edit order cutoff tomorrow orders from big query.
Uses pymorri Customer API to retrieve each customer’s details using id, then formats and validates the data. The Marketing API then attempts to send an email and sms to each customer found.
The success or failure of these attempts is recorded and sent as a report to a big query table.
-
ecstask.main.get_application_env()[source]¶ Method to fetch the application environment from the command line
- Returns
A 3 letter environment description.
- Return type
str
Examples
“[0-9]{3,4}” - Building feature branch with number (relates to ticket reference in Jira)
“dev” - Building develop branch
“prd” - production environment