From 2cd67bd2958cf6524c2041d3a282975049d1e8ca Mon Sep 17 00:00:00 2001 From: tyrin Date: Thu, 8 May 2025 16:27:13 +0300 Subject: [PATCH] expose batch size as a cli argument in the load_survey command --- management/commands/load_survey.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/management/commands/load_survey.py b/management/commands/load_survey.py index ad4e91f..636df85 100644 --- a/management/commands/load_survey.py +++ b/management/commands/load_survey.py @@ -15,7 +15,7 @@ from datetime import datetime # DEFINE BATCH SIZE AND BATCH # ************************************************************** -BATCH_SIZE = 1000000 +#BATCH_SIZE = 1000000 def batch(iterable, size): """ @@ -56,7 +56,12 @@ class Command(BaseCommand): required=True, help='Integer ID of the survey being read' ) - + parser.add_argument( + '--batch_size', + type=int, + required=True, + help='Integer number of pixels to be inserted into the database at once' + ) def handle(self, *args, **options): @@ -67,6 +72,7 @@ class Command(BaseCommand): counts_file = options['counts'] exposure_file = options['exposure'] survey_number = options['survey_number'] + BATCH_SIZE = options['batch_size'] self.stdout.write(f"\nCounts file:\t{counts_file}") self.stdout.write(f"Exposure file:\t{exposure_file}")