@@ -65,11 +65,19 @@ class AzureBlobHistoryExportWriterOptions:
6565 def __post_init__ (self ) -> None :
6666 if not self .container_name :
6767 raise ValueError ("container_name is required" )
68+ if self .connection_string and self .account_url :
69+ raise ValueError (
70+ "'connection_string' and 'account_url' are mutually exclusive"
71+ )
6872 if not self .connection_string and not self .account_url :
6973 raise ValueError (
7074 "Either 'connection_string' or 'account_url' (with 'credential') "
7175 "must be provided"
7276 )
77+ if self .account_url and self .credential is None :
78+ raise ValueError (
79+ "'credential' is required when 'account_url' is provided"
80+ )
7381
7482
7583class AzureBlobHistoryExportWriter :
@@ -116,19 +124,33 @@ def write(
116124 self ,
117125 * ,
118126 instance_id : str ,
127+ container : str ,
119128 blob_name : str ,
120129 payload : bytes ,
121130 content_type : str ,
122131 content_encoding : str | None ,
123132 ) -> None :
124133 del instance_id # included by the protocol but not needed here
134+ # This writer pins to the container configured at construction
135+ # time and ignores the per-call ``container`` argument; the
136+ # configured value is authoritative for any given writer
137+ # instance. Run a separate writer per destination container
138+ # if you need per-job routing.
139+ del container
125140 self ._ensure_container ()
126141 container_client = self ._service .get_container_client (
127142 self ._options .container_name
128143 )
129- content_settings = ContentSettings (
130- content_type = content_type ,
131- content_encoding = content_encoding or "" ,
144+ # Only set Content-Encoding if the format actually compresses
145+ # the payload; an empty header value would be persisted on
146+ # the blob and confuse downstream clients.
147+ content_settings = (
148+ ContentSettings (
149+ content_type = content_type ,
150+ content_encoding = content_encoding ,
151+ )
152+ if content_encoding
153+ else ContentSettings (content_type = content_type )
132154 )
133155 container_client .upload_blob (
134156 name = blob_name ,
0 commit comments