Skip to content

Commit ccc631c

Browse files
committed
Write to the APDB in chunks to avoid overwhelming the database
1 parent 4b4be9b commit ccc631c

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

python/lsst/ap/association/diaPipe.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,16 @@ class DiaPipelineConfig(pipeBase.PipelineTaskConfig,
309309
doc="Pad the image by this many pixels before removing off-image "
310310
"diaObjects for association.",
311311
)
312+
maximumTableLength = pexConfig.RangeField(
313+
dtype=int,
314+
default=500,
315+
min=0,
316+
max=65535,
317+
doc="Maximum length of tables allowed to be written in one operation"
318+
" to the APDB. Set to 0 to disable."
319+
"The maximum is the hard limit on the number of records in the"
320+
" Cassandra APDB that can be updated in one transaction",
321+
)
312322
idGenerator = DetectorVisitIdGeneratorConfig.make_field()
313323

314324
def setDefaults(self):
@@ -786,7 +796,8 @@ def writeToApdb(self, updatedDiaObjects, associatedDiaSources, diaForcedSources)
786796
DateTime.now().toAstropy(),
787797
diaObjectStore,
788798
diaSourceStore,
789-
diaForcedSourceStore)
799+
diaForcedSourceStore,
800+
maximum_table_length=self.config.maximumTableLength)
790801
self.log.info("APDB updated.")
791802

792803
def testDataFrameIndex(self, df):

0 commit comments

Comments
 (0)