We have the ability to send basic pre canned message templates, see here.
This task it to write a decorator such that said messages are enriched with "online only" contextual information.
initial use case - including the url to a glue job in any outgoing messages sert from a glue job.
What to do
Here is an example decorator
def enrich_online(message_creating_function):
def wrapper(*args):
msg: str = message_creating_function(*args)
# Do something here to enrich "msg" which will
# have added what we want to it.
# For now - see the "what does the decorator need to do"
# section down below.
return msg
return wrapper
which you would use like so
@enrich_online
def unexpected_error(msg: str, error: Exception) -> str:
# the rest of this function, please see
# https://github.com/ONSdigital/dp-data-pipelines/blob/0682f4e8ca72fc5309bbd032c56a85acceeedb92/dpypelines/pipeline/shared/message.py#L13C1-L13C57
...what does the decorator need to do...
This task is not to work out the url we want from glue (that's a different task). What we want here is:
if (and only if) there is an env var set of ENRICH_OUTGOING_MESSAGES
add a line break then the text notification-source to the message. That's it, this is just a holding value until the other task is done.
Important - dont get tangled on the logic of this. In essence all we want right now is a decorator that will sit on top of a function that returns a string - and add something to the end of the string being returned, that's it.
Acceptance Criteria
[ ] decorator is written and all message functions are decorated
What is this
We have the ability to send basic pre canned message templates, see here.
This task it to write a decorator such that said messages are enriched with "online only" contextual information.
initial use case - including the url to a glue job in any outgoing messages sert from a glue job.
What to do
Here is an example decorator
which you would use like so
...what does the decorator need to do...
This task is not to work out the url we want from glue (that's a different task). What we want here is:
ENRICH_OUTGOING_MESSAGES
notification-source
to the message. That's it, this is just a holding value until the other task is done.Important - dont get tangled on the logic of this. In essence all we want right now is a decorator that will sit on top of a function that returns a string - and add something to the end of the string being returned, that's it.
Acceptance Criteria