Skip to content

Commit

Permalink
Replace faulty chunk counting logic (#391)
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederick Morlock (Hinalea) authored Aug 15, 2022
1 parent c486182 commit 9eb645e
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions gradient/commands/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import re
import threading
import uuid
import json
import math
try:
import queue
except ImportError:
Expand Down Expand Up @@ -616,12 +616,11 @@ def _put(self, session, path, url, content_type, dataset_version_id=None, key=No

parts = []
with open(path, 'rb') as f:
# we +2 the number of parts since we're doing floor
# division, which will cut off any trailing part
# less than the part_minsize, AND we want to 1-index
# our range to match what AWS expects for part
# numbers
for part in range(1, (size // part_minsize) + 2):
# we +1 the number of parts since we count from zero
# to match what AWS expects for part numbers. We use
# `ceil` to capture any remaining data less than
# part_minsize at the end of upload
for part in range(1, math.ceil(size / part_minsize) + 1):
presigned_url_res = api_client.post(
url=mpu_url,
json={
Expand Down

0 comments on commit 9eb645e

Please sign in to comment.