@@ -136,28 +136,32 @@ def mirror_source(self, catalog: CatalogName, source_json: JSON):
136136 source = plugin .source_ref_cls .from_json (source_json )
137137 assert source .id in plugin .list_source_ids (authentication = None ), R (
138138 'Cannot mirror non-public source' , source )
139- # The desired partition size depends on the maximum number of messages
140- # we can send in one Lambda invocation, because queueing the individual
141- # mirror_file messages turns out to dominate the running time of
142- # handling a mirror_source message.
143- partition_size = int (
144- aws .sqs_fifo_rate_limit # max. # of SendMessage calls per second
145- * self .client .queues .batch_size # number of messages per call
146- * config .mirror_lambda_timeout # max. duration of the invocation
147- / config .mirroring_concurrency # number of concurrent invocations
148- / 2 # safety margin
149- )
150- source = plugin .partition_source_for_mirroring (catalog , source , partition_size )
151- prefix = source .prefix
152- log .info ('Queueing %d partitions of source %r in catalog %r' ,
153- prefix .num_partitions , str (source .spec ), catalog )
139+ if not source .config .mirror :
140+ log .info ('Not mirroring source % r in catalog %r because `no_mirror` flag is present' ,
141+ str (source .spec ), str (catalog ))
142+ else :
143+ # The desired partition size depends on the maximum number of messages
144+ # we can send in one Lambda invocation, because queueing the individual
145+ # mirror_file messages turns out to dominate the running time of
146+ # handling a mirror_source message.
147+ partition_size = int (
148+ aws .sqs_fifo_rate_limit # max. # of SendMessage calls per second
149+ * self .client .queues .batch_size # number of messages per call
150+ * config .mirror_lambda_timeout # max. duration of the invocation
151+ / config .mirroring_concurrency # number of concurrent invocations
152+ / 2 # safety margin
153+ )
154+ source = plugin .partition_source_for_mirroring (catalog , source , partition_size )
155+ prefix = source .prefix
156+ log .info ('Queueing %d partitions of source %r in catalog %r' ,
157+ prefix .num_partitions , str (source .spec ), catalog )
154158
155- def message (partition : str ) -> SQSMessage :
156- log .debug ('Queueing partition %r' , partition )
157- return self .mirror_partition_message (catalog , source , partition )
159+ def message (partition : str ) -> SQSMessage :
160+ log .debug ('Queueing partition %r' , partition )
161+ return self .mirror_partition_message (catalog , source , partition )
158162
159- messages = map (message , prefix .partition_prefixes ())
160- self .client .queue_mirror_messages (messages )
163+ messages = map (message , prefix .partition_prefixes ())
164+ self .client .queue_mirror_messages (messages )
161165
162166 def mirror_partition (self ,
163167 catalog : CatalogName ,
0 commit comments