Utils Code¶
Overview¶
The utils module contains common functions available for use by any of the other modules and classes in the project.
Code¶
This module contains common utilities.
- ecstask.resources.utils.retry_if_mori_exc_and_not_404(exc: Exception) bool[source]¶
Return True if we should retry, False otherwise.
- ecstask.resources.utils.validate_kafka_message(kafka_message: dict, store_validator, min_validator) tuple[dict, dict, str][source]¶
Validate the message that was received from Kafka before creating the payload that will be sent to the stock transfer service.
- Parameters
kafka_message – The message that was received from Kafka
store_validator – The wrapper of location API
min_validator – The wrapper of the product API
- Returns
- The Kafka message stripped of invalid store and MINs,
the message to be written to DLQ and status message
- Return type
tuple