@@ -130,17 +130,21 @@ def mirror_source(self, catalog: CatalogName, source_json: JSON):
130130 source = plugin .source_ref_cls .from_json (source_json )
131131 assert source .id in plugin .list_source_ids (authentication = None ), R (
132132 'Cannot mirror non-public source' , source )
133- source = plugin .partition_source_for_mirroring (catalog , source )
134- prefix = source .spec .prefix
135- log .info ('Queueing %d partitions of source %r in catalog %r' ,
136- prefix .num_partitions , str (source .spec ), catalog )
133+ if 'no_mirror' in source .spec .flags :
134+ log .info ('Not mirroring source % r in catalog %r because `no_mirror` flag is present' ,
135+ str (source .spec ), str (catalog ))
136+ else :
137+ source = plugin .partition_source_for_mirroring (catalog , source )
138+ prefix = source .spec .prefix
139+ log .info ('Queueing %d partitions of source %r in catalog %r' ,
140+ prefix .num_partitions , str (source .spec ), catalog )
137141
138- def message (partition : str ) -> SQSMessage :
139- log .debug ('Queueing partition %r' , partition )
140- return self .mirror_partition_message (catalog , source , partition )
142+ def message (partition : str ) -> SQSMessage :
143+ log .debug ('Queueing partition %r' , partition )
144+ return self .mirror_partition_message (catalog , source , partition )
141145
142- messages = map (message , prefix .partition_prefixes ())
143- self .client .queue_mirror_messages (messages )
146+ messages = map (message , prefix .partition_prefixes ())
147+ self .client .queue_mirror_messages (messages )
144148
145149 def mirror_partition (self ,
146150 catalog : CatalogName ,
@@ -167,13 +171,9 @@ def mirror_file(self,
167171 file = self .load_file (catalog , file_json )
168172 assert file .size is not None , R ('File size unknown' , file )
169173
170- file_is_large = file .size > 1.5 * 1024 ** 3
171- deployment_is_stable = (config .deployment .is_stable
172- and not config .deployment .is_unit_test
173- and catalog not in config .integration_test_catalogs )
174-
174+ max_file_size = config .catalogs [catalog ].mirror_max_file_size
175175 service = self .service (catalog )
176- if file_is_large and not deployment_is_stable :
176+ if max_file_size is not None and file . size > max_file_size :
177177 log .info ('Not mirroring file to save cost: %r' , file )
178178 elif service .info_exists (file ):
179179 log .info ('File is already mirrored, skipping upload: %r' , file )
0 commit comments