They follow the same semantics as persistent payloads, but both persistent and non-persistent headers are available from the same dict to keep it easier for users. Both internal and service code tends to directly modify self.headers collection so it was important also for compatibility.
Copy of headers_persistent goes to the serialized JSON as well. Values contained there always take precedence over headers, so it should be consistent.
For compatibility: we need to keep a copy in payload_persistent, because older consumer making a new Task(...) will pass headers without persistent ones so they will be lost. As we keep it in payload_persistent, they will be placed back in headers_persistent during deserialization made by karton.system
Reasons to implement that:
share_3rd_party
header within karton-archive-extractor.quality
that needs to be passed manually from task to task: https://github.com/CERT-Polska/karton-classifier/blob/master/karton/classifier/classifier.py#L102Few design details:
self.headers
collection so it was important also for compatibility.headers_persistent
goes to the serialized JSON as well. Values contained there always take precedence overheaders
, so it should be consistent.payload_persistent
, because older consumer making a newTask(...)
will pass headers without persistent ones so they will be lost. As we keep it inpayload_persistent
, they will be placed back inheaders_persistent
during deserialization made bykarton.system