Skip to content

Commit e4bf4bf

Browse files
Ilija VukoticBenGalewsky
authored andcommitted
now chunk length is a parameter
1 parent f66d0d3 commit e4bf4bf

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/servicex_did_finder_lib/servicex_adaptor.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232

3333

3434
MAX_RETRIES = 3
35-
CH_LEN = 30
3635

3736

3837
class ServiceXAdapter:
@@ -92,10 +91,10 @@ def put_file_add(self, file_info):
9291
self.logger.error(f'After {attempts} tries, failed to send ServiceX App a put_file '
9392
f'message: {str(file_info)} - Ignoring error.')
9493

95-
def put_file_add_bulk(self, file_list):
94+
def put_file_add_bulk(self, file_list, chunk_length=30):
9695
# we first chunk up file_list as it can be very large in
9796
# case there are a lot of replicas and a lot of files.
98-
chunks = [file_list[i:i + CH_LEN] for i in range(0, len(file_list), CH_LEN)]
97+
chunks = [file_list[i:i + chunk_length] for i in range(0, len(file_list), chunk_length)]
9998
for chunk in chunks:
10099
success = False
101100
attempts = 0

0 commit comments

Comments
 (0)