Skip to content
This repository was archived by the owner on Jul 19, 2024. It is now read-only.

Commit a135b1a

Browse files
committed
Raised default block size to 4096
1 parent db86d4c commit a135b1a

File tree

9 files changed

+72
-72
lines changed

9 files changed

+72
-72
lines changed

batchapps/api.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ def get_output(self,
438438
otype='output',
439439
url=None,
440440
callback=None,
441-
block=1024):
441+
block=4096):
442442
"""
443443
Gets the content of the job output or its thumbnail.
444444
Either ``url``, or both ``job_id`` and ``otype`` must be set.
@@ -462,10 +462,10 @@ def get_output(self,
462462
supplied, ``job_id`` and ``otype`` will not be used.
463463
The default is None.
464464
- callback (func): A function to be called to report download progress.
465-
The function takes three parameters: the percent downloaded (float), the
465+
The function must take three arguments: the percent downloaded (float), the
466466
bytes downloaded (float), and the total bytes to be downloaded (float).
467467
- block (int): The amount of data downloaded in each block - determines
468-
the frequency with which the callback is called. Default is 1024.
468+
the frequency with which the callback is called. Default is 4096.
469469
470470
:Returns:
471471
- :class:`.Response` with the GET response, however this is not
@@ -627,7 +627,7 @@ def get_output_file(self,
627627
fname=None,
628628
url=None,
629629
callback=None,
630-
block=1024):
630+
block=4096):
631631
"""
632632
Gets the content of a file created in a job.
633633
Either ``url``, or both ``job_id`` and ``fname`` must be set.
@@ -648,10 +648,10 @@ def get_output_file(self,
648648
- url (str): The URL directly to the file to be downloaded.
649649
The default is None.
650650
- callback (func): A function to be called to report download progress.
651-
The function takes three parameters: the percent downloaded (float), the
651+
The function must take three arguments: the percent downloaded (float), the
652652
bytes downloaded (float), and the total bytes to be downloaded (float).
653653
- block (int): The amount of data downloaded in each block - determines
654-
the frequency with which the callback is called. Default is 1024.
654+
the frequency with which the callback is called. Default is 4096.
655655
656656
:Returns:
657657
- :class:`.Response` with the GET response, however this is not
@@ -1024,7 +1024,7 @@ def query_missing_files(self, files):
10241024

10251025

10261026
def get_file(self, userfile, size, download_dir, overwrite=False,
1027-
callback=None, block=1024):
1027+
callback=None, block=4096):
10281028
"""Gets the content of a file previously uploaded by the user.
10291029
10301030
:Args:
@@ -1040,10 +1040,10 @@ def get_file(self, userfile, size, download_dir, overwrite=False,
10401040
- overwrite (bool): Whether to overwrite a destination file if it
10411041
already exists. The default is ``False``.
10421042
- callback (func): A function to be called to report download progress.
1043-
The function takes three parameters: the percent downloaded (float), the
1043+
The function must take three arguments: the percent downloaded (float), the
10441044
bytes downloaded (float), and the total bytes to be downloaded (float).
10451045
- block (int): The amount of data downloaded in each block - determines
1046-
the frequency with which the callback is called. Default is 1024.
1046+
the frequency with which the callback is called. Default is 4096.
10471047
10481048
:Returns:
10491049
- :class:`.Response` with the GET response, however this is not
@@ -1113,7 +1113,7 @@ def props_file(self, userfile):
11131113
else:
11141114
return Response(True, head_resp)
11151115

1116-
def send_file(self, userfile, callback=None, block=1024):
1116+
def send_file(self, userfile, callback=None, block=4096):
11171117
"""Uploads a user file for use in a job.
11181118
11191119
:Args:
@@ -1123,10 +1123,10 @@ def send_file(self, userfile, callback=None, block=1024):
11231123
11241124
:Kwargs:
11251125
- callback (func): A function to be called to report upload progress.
1126-
The function takes three parameters: the percent uploaded (float), the
1126+
The function must take three arguments: the percent uploaded (float), the
11271127
bytes uploaded (float), and the total bytes to be uploaded (float).
11281128
- block (int): The amount of data uploaded in each block - determines
1129-
the frequency with which the callback is called. Default is 1024.
1129+
the frequency with which the callback is called. Default is 4096.
11301130
11311131
:Returns:
11321132
- :class:`.Response` with the PUT response, however this is not

batchapps/files.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def __delitem__(self, filekey):
177177
self._collection = [a for a in self._collection
178178
if a.name != filekey]
179179

180-
def _upload_forced(self, userfile, callback=None, block=1024):
180+
def _upload_forced(self, userfile, callback=None, block=4096):
181181
"""Upload a single file in the collection, ignoring overwrite.
182182
Only used internally in :func:upload by the parallel subprocesses
183183
@@ -187,18 +187,18 @@ def _upload_forced(self, userfile, callback=None, block=1024):
187187
188188
:Kwargs:
189189
- callback (func): A function to be called to report upload progress.
190-
The function takes three parameters: the percent uploaded (float), the
190+
The function must take three arguments: the percent uploaded (float), the
191191
bytes uploaded (float), and the total bytes to be uploaded (float).
192192
- block (int): The amount of data uploaded in each block - determines
193-
the frequency with which the callback is called. Default is 1024.
193+
the frequency with which the callback is called. Default is 4096.
194194
195195
:Returns:
196196
- A tuple containing the result of the :func:`UserFile.upload` call,
197197
and the original userfile:
198198
``(bool success, userfile, string result)``
199199
"""
200200
self._log.debug("About to upload file: {0}".format(userfile))
201-
resp = userfile.upload(force=True, callback=callback, block=1024)
201+
resp = userfile.upload(force=True, callback=callback, block=4096)
202202

203203
# TODO: Need to fix hanging when we try to return the result
204204
# object rather than just a string.
@@ -370,7 +370,7 @@ def remove(self, userfile):
370370
raise TypeError("File to remove must be userfile object, "
371371
"filename string, userfile index int or slice")
372372

373-
def upload(self, force=False, threads=None, callback=None, block=1024):
373+
def upload(self, force=False, threads=None, callback=None, block=4096):
374374
"""Upload all files in a set, optionally in parallel
375375
376376
:Kwargs:
@@ -380,10 +380,10 @@ def upload(self, force=False, threads=None, callback=None, block=1024):
380380
- threads (int): Maximum number of parallel uploads, default is 1
381381
(i.e. not parallel). Max threads is 10.
382382
- callback (func): A function to be called to report upload progress.
383-
The function takes three parameters: the percent uploaded (float), the
383+
The function must take three arguments: the percent uploaded (float), the
384384
bytes uploaded (float), and the total bytes to be uploaded (float).
385385
- block (int): The amount of data uploaded in each block - determines
386-
the frequency with which the callback is called. Default is 1024.
386+
the frequency with which the callback is called. Default is 4096.
387387
388388
:Returns:
389389
- A list of tuples containing any files that failed to upload and
@@ -787,18 +787,18 @@ def create_submit_specifier(self):
787787
self._log.debug("File specification: {0}".format(file_spec))
788788
return file_spec
789789

790-
def upload(self, force=False, callback=None, block=1024):
790+
def upload(self, force=False, callback=None, block=4096):
791791
"""Upload file.
792792
793793
:Kwargs:
794794
- force (bool): If ``True``, uploads regardless of whether the
795795
file has already been uploaded. Otherwise checks if file has
796796
been uploaded, and if so, skips. The default is ``False``.
797797
- callback (func): A function to be called to report upload progress.
798-
The function takes three parameters: the percent uploaded (float), the
798+
The function must take three arguments: the percent uploaded (float), the
799799
bytes uploaded (float), and the total bytes to be uploaded (float).
800800
- block (int): The amount of data uploaded in each block - determines
801-
the frequency with which the callback is called. Default is 1024.
801+
the frequency with which the callback is called. Default is 4096.
802802
803803
:Returns:
804804
- Client :class:`.Response` object if upload was attempted.
@@ -846,7 +846,7 @@ def is_uploaded(self):
846846
else:
847847
raise resp.result
848848

849-
def download(self, download_dir, callback=None, block=1024):
849+
def download(self, download_dir, callback=None, block=4096):
850850
"""Download file.
851851
852852
:Args:
@@ -855,10 +855,10 @@ def download(self, download_dir, callback=None, block=1024):
855855
856856
:Kwargs:
857857
- callback (func): A function to be called to report download progress.
858-
The function takes three parameters: the percent downloaded (float), the
858+
The function must take three arguments: the percent downloaded (float), the
859859
bytes downloaded (float), and the total bytes to be downloaded (float).
860860
- block (int): The amount of data downloaded in each block - determines
861-
the frequency with which the callback is called. Default is 1024.
861+
the frequency with which the callback is called. Default is 4096.
862862
863863
:Raises:
864864
- :class:`.RestCallException` if an error occurred during the

batchapps/job.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ def _format_submission(self, sub):
555555
self._log.debug("Extracted job submission data: {0}".format(formatted))
556556
return formatted
557557

558-
def _get_final_output(self, download_dir, overwrite, callback=None, block=1024):
558+
def _get_final_output(self, download_dir, overwrite, callback=None, block=4096):
559559
"""Internal method to download jobs final output.
560560
561561
:Args:
@@ -566,10 +566,10 @@ def _get_final_output(self, download_dir, overwrite, callback=None, block=1024):
566566
567567
:Kwargs:
568568
- callback (func): A function to be called to report download progress.
569-
The function takes three parameters: the percent downloaded (float), the
569+
The function must take three arguments: the percent downloaded (float), the
570570
bytes downloaded (float), and the total bytes to be downloaded (float).
571571
- block (int): The amount of data downloaded in each block - determines
572-
the frequency with which the callback is called. Default is 1024.
572+
the frequency with which the callback is called. Default is 4096.
573573
574574
:Returns:
575575
- :class:`.Response` object returned directly from
@@ -599,7 +599,7 @@ def _get_final_output(self, download_dir, overwrite, callback=None, block=1024):
599599
callback=callback,
600600
block=block)
601601

602-
def _get_final_preview(self, download_dir, filename, overwrite, callback=None, block=1024):
602+
def _get_final_preview(self, download_dir, filename, overwrite, callback=None, block=4096):
603603
"""Internal method to download jobs final thumbnail.
604604
We don't bother to check file size for download feedback, as it's
605605
assumed to be very small.
@@ -613,10 +613,10 @@ def _get_final_preview(self, download_dir, filename, overwrite, callback=None, b
613613
614614
:Kwargs:
615615
- callback (func): A function to be called to report download progress.
616-
The function takes three parameters: the percent downloaded (float), the
616+
The function must take three arguments: the percent downloaded (float), the
617617
bytes downloaded (float), and the total bytes to be downloaded (float).
618618
- block (int): The amount of data downloaded in each block - determines
619-
the frequency with which the callback is called. Default is 1024.
619+
the frequency with which the callback is called. Default is 4096.
620620
621621
:Returns:
622622
- :class:`.Response` object returned directly from
@@ -630,7 +630,7 @@ def _get_final_preview(self, download_dir, filename, overwrite, callback=None, b
630630
callback=callback,
631631
block=block)
632632

633-
def _get_intermediate_output(self, output, download_dir, overwrite, callback=None, block=1024):
633+
def _get_intermediate_output(self, output, download_dir, overwrite, callback=None, block=4096):
634634
"""Internal method to download any file from the job output.
635635
636636
:Args:
@@ -643,10 +643,10 @@ def _get_intermediate_output(self, output, download_dir, overwrite, callback=Non
643643
644644
:Kwargs:
645645
- callback (func): A function to be called to report download progress.
646-
The function takes three parameters: the percent downloaded (float), the
646+
The function must take three arguments: the percent downloaded (float), the
647647
bytes downloaded (float), and the total bytes to be downloaded (float).
648648
- block (int): The amount of data downloaded in each block - determines
649-
the frequency with which the callback is called. Default is 1024.
649+
the frequency with which the callback is called. Default is 4096.
650650
651651
652652
:Returns:
@@ -705,7 +705,7 @@ def get_tasks(self):
705705
else:
706706
raise resp.result
707707

708-
def get_output(self, download_dir, output=None, overwrite=False, callback=None, block=1024):
708+
def get_output(self, download_dir, output=None, overwrite=False, callback=None, block=4096):
709709
"""
710710
Download a job output file.
711711
This could be the jobs final output, or if specified, any intermediate
@@ -721,10 +721,10 @@ def get_output(self, download_dir, output=None, overwrite=False, callback=None,
721721
will be downloaded, otherwise the job's final output will be
722722
downloaded.
723723
- callback (func): A function to be called to report download progress.
724-
The function takes three parameters: the percent downloaded (float), the
724+
The function must take three arguments: the percent downloaded (float), the
725725
bytes downloaded (float), and the total bytes to be downloaded (float).
726726
- block (int): The amount of data downloaded in each block - determines
727-
the frequency with which the callback is called. Default is 1024.
727+
the frequency with which the callback is called. Default is 4096.
728728
729729
:Returns:
730730
- The full path to the downloaded file (str).
@@ -987,7 +987,7 @@ def __init__(self, client, job_id, **props):
987987
'type': _output.get('kind')
988988
})
989989

990-
def _get_file(self, output, download_dir, overwrite, callback=None, block=1024):
990+
def _get_file(self, output, download_dir, overwrite, callback=None, block=4096):
991991
"""Internal method to download a task output.
992992
993993
:Args:
@@ -1000,10 +1000,10 @@ def _get_file(self, output, download_dir, overwrite, callback=None, block=1024):
10001000
10011001
:Kwargs:
10021002
- callback (func): A function to be called to report download progress.
1003-
The function takes three parameters: the percent downloaded (float), the
1003+
The function must take three arguments: the percent downloaded (float), the
10041004
bytes downloaded (float), and the total bytes to be downloaded (float).
10051005
- block (int): The amount of data downloaded in each block - determines
1006-
the frequency with which the callback is called. Default is 1024.
1006+
the frequency with which the callback is called. Default is 4096.
10071007
10081008
:Returns:
10091009
- :class:`.Response` object returned directly from
@@ -1044,7 +1044,7 @@ def get_thumbnail(self, download_dir=None, filename=None, overwrite=True, callba
10441044
- overwrite (bool): Whether an existing file will be overwritten.
10451045
The default is ``True``.
10461046
- callback (func): A function to be called to report download progress.
1047-
The function takes three parameters: the percent downloaded (float), the
1047+
The function must take three arguments: the percent downloaded (float), the
10481048
bytes downloaded (float), and the total bytes to be downloaded (float).
10491049
10501050
:Returns:
@@ -1109,7 +1109,7 @@ def list_outputs(self):
11091109
else:
11101110
raise resp.result
11111111

1112-
def get_output(self, output, download_dir, overwrite=False, callback=None, block=1024):
1112+
def get_output(self, output, download_dir, overwrite=False, callback=None, block=4096):
11131113
"""Download a task output file.
11141114
11151115
:Args:
@@ -1122,10 +1122,10 @@ def get_output(self, output, download_dir, overwrite=False, callback=None, block
11221122
- overwrite (bool): Whether to overwrite an existing file.
11231123
The default is ``False``.
11241124
- callback (func): A function to be called to report download progress.
1125-
The function takes three parameters: the percent downloaded (float), the
1125+
The function must take three arguments: the percent downloaded (float), the
11261126
bytes downloaded (float), and the total bytes to be downloaded (float).
11271127
- block (int): The amount of data downloaded in each block - determines
1128-
the frequency with which the callback is called. Default is 1024.
1128+
the frequency with which the callback is called. Default is 4096.
11291129
11301130
:Returns:
11311131
- The full path to the downloaded file (str).

batchapps/job_manager.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def create_job(self, name, **jobdetails):
182182
"""
183183
return JobSubmission(self._client, str(name), **jobdetails)
184184

185-
def submit(self, submitjob, upload_threads=None, callback=None, block=1024):
185+
def submit(self, submitjob, upload_threads=None, callback=None, block=4096):
186186
"""Submit a job, and upload all its assets
187187
188188
:Args:
@@ -192,10 +192,10 @@ def submit(self, submitjob, upload_threads=None, callback=None, block=1024):
192192
- upload_threads (int): Maximum number of concurrent asset uploads.
193193
The default is 1.
194194
- callback (func): A function to be called to report upload progress.
195-
The function takes three parameters: the percent uploaded (float), the
195+
The function must take three arguments: the percent uploaded (float), the
196196
bytes uploaded (float), and the total bytes to be uploaded (float).
197197
- block (int): The amount of data uploaded in each block - determines
198-
the frequency with which the callback is called. Default is 1024.
198+
the frequency with which the callback is called. Default is 4096.
199199
200200
:Returns:
201201
- A job submission response dictionary in the format:

0 commit comments

Comments
 (0)