Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
a11a1ce
update the lineage to use core zone file instead of greenroom
May 2, 2023
d801e8d
bumpup version
May 15, 2023
132ec41
bumpup version to 2.5.0
May 15, 2023
6d72061
Merge pull request #56 from PilotDataPlatform/rc/staging-release-1505…
andricDu May 15, 2023
0d9d769
fixes versioning
andricDu May 16, 2023
77414e7
bumpup version
May 16, 2023
e5bc635
Merge branch 'main' into PILOT-2809
colorzzr May 16, 2023
922e9cf
Merge pull request #53 from PilotDataPlatform/PILOT-2809
andricDu May 16, 2023
8f37acc
Merge branch 'main' into develop
May 17, 2023
94b803a
Pilot 2936: add an action to create the cli with mac version (#59)
colorzzr May 18, 2023
b651dd5
fixup the dataset download issue. need more test cases
May 29, 2023
476b15e
merge
Jun 2, 2023
2d1377d
Merge branch 'develop' of https://github.com/PilotDataPlatform/cli in…
Jun 7, 2023
e1feff2
Merge branch 'develop' of https://github.com/PilotDataPlatform/cli in…
Jun 12, 2023
85bddf5
update the version to 2.5.0
Jun 12, 2023
0fcf173
bump to next version for staging release
Jun 12, 2023
8b0fd0c
update the version in the help page to 2.5.1
Jun 12, 2023
3c62f5b
Merge branch 'main' into rc/staging-release-12062023
colorzzr Jun 12, 2023
b6344e0
add back the git action command
Jun 13, 2023
c3ab5de
Merge pull request #67 from PilotDataPlatform/rc/staging-release-1206…
andricDu Jun 13, 2023
6226591
Merge branch 'main' into rc/staging-release-15082023
colorzzr Aug 15, 2023
98f35f9
Merge pull request #84 from PilotDataPlatform/rc/staging-release-1508…
andricDu Aug 15, 2023
f68911c
fix the building issue due to the version mismatch between pydantic a…
Aug 16, 2023
0908567
test workflow
Aug 16, 2023
64b0051
test workflow
Aug 16, 2023
30640da
remove the test workflow
Aug 16, 2023
5784ebf
remove the test workflow
Aug 16, 2023
4658480
Merge pull request #85 from PilotDataPlatform/rc/staging-release-1508…
andricDu Aug 16, 2023
000c833
bumpup to 2.6.0 to align with portal version
Aug 17, 2023
ac97a77
update the version in help page
Aug 17, 2023
15a5134
Merge pull request #86 from PilotDataPlatform/rc/staging-release-1508…
andricDu Aug 17, 2023
f6d56be
PILOT-3493: Attribute automated release git tags to main branch
dafelipe130 Aug 17, 2023
3092d09
Merge pull request #87 from PilotDataPlatform/PILOT-3493-attribute-au…
andricDu Aug 17, 2023
2cf74fb
PILOT-3493: Align release commit according to the branch being built
dafelipe130 Aug 22, 2023
595da2c
PILOT-3486: fixup the upload and resumable upload issues (#88)
colorzzr Aug 23, 2023
31c2ceb
merge back with next preminor version
Sep 1, 2023
655462b
update version number in user help page
Sep 1, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ jobs:
body: ${{ github.event.head_commit.message }}
draft: false
prerelease: false
target_commitish: ${{ needs.extract-branch-name.outputs.branch }}
files: ./app/bundled_app/linux/pilotcli_linux

push-binary-macos:
Expand Down
2 changes: 1 addition & 1 deletion app/resources/custom_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
class HelpPage:
page = {
'update': {
'version': '2.5.1',
'version': '2.7.0a0',
'1': 'The logic of normal upload and resumble are splited. '
'add new command for resumable upload as `pilotcli file resume -r manifest.json`',
'2': 'The manifest file will be output for both file/folder upload',
Expand Down
15 changes: 10 additions & 5 deletions app/services/file_manager/file_upload/upload_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,21 +262,21 @@ def stream_upload(self, file_object: FileObject, pool: ThreadPool) -> List[Apply
while True:
chunk = f.read(self.chunk_size)
chunk_etag = file_object.uploaded_chunks.get(str(count + 1))
local_chunk_etag = hashlib.md5(chunk).hexdigest()
if not chunk:
break
# if current chunk has been uploaded to object storage
# only check the md5 if the file is same. If ture,
# skip current chunk, if not, raise the error.
elif chunk_etag:
local_chunk_etag = hashlib.md5(chunk).hexdigest()
if chunk_etag != local_chunk_etag:
SrvErrorHandler.customized_handle(ECustomizedError.INVALID_CHUNK_UPLOAD, value=count + 1)
raise INVALID_CHUNK_ETAG(count + 1)
file_object.update_progress(self.chunk_size)
else:
res = pool.apply_async(
self.upload_chunk,
args=(file_object, count + 1, chunk),
args=(file_object, count + 1, chunk, local_chunk_etag),
)
chunk_result.append(res)

Expand All @@ -286,7 +286,7 @@ def stream_upload(self, file_object: FileObject, pool: ThreadPool) -> List[Apply

return chunk_result

def upload_chunk(self, file_object: FileObject, chunk_number: int, chunk: str) -> None:
def upload_chunk(self, file_object: FileObject, chunk_number: int, chunk: str, etag: str) -> None:
"""
Summary:
The function is to upload a chunk directly into minio storage.
Expand All @@ -295,6 +295,7 @@ def upload_chunk(self, file_object: FileObject, chunk_number: int, chunk: str) -
information for chunk uploading.
- chunk_number(int): the number of current chunk.
- chunk(str): the chunk data.
- etag(str): the md5 of chunk data.
return:
- None
"""
Expand All @@ -313,7 +314,11 @@ def upload_chunk(self, file_object: FileObject, chunk_number: int, chunk: str) -
'upload_id': file_object.resumable_id,
'chunk_number': chunk_number,
}
headers = {'Authorization': 'Bearer ' + self.user.access_token, 'Session-ID': self.user.session_id}
headers = {
'Authorization': 'Bearer ' + self.user.access_token,
'Session-ID': self.user.session_id,
'Content-MD5': etag,
}
response = httpx.get(
self.base_url + '/v1/files/chunks/presigned',
params=params,
Expand All @@ -326,7 +331,7 @@ def upload_chunk(self, file_object: FileObject, chunk_number: int, chunk: str) -
presigned_chunk_url = response.json().get('result')
res = httpx.put(presigned_chunk_url, data=chunk, timeout=None)

if res.status_code != 200:
if res.status_code not in [200, 201]:
error_msg = 'Fail to upload the chunck %s: %s' % (chunk_number, str(res.text))
raise Exception(error_msg)

Expand Down
69 changes: 28 additions & 41 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "app"
version = "2.5.2"
version = "2.7.0a0"
description = "This service is designed to support pilot platform"
authors = ["Indoc Systems"]

Expand All @@ -16,10 +16,10 @@ requests = "^2.28.2"
pydantic-settings = "2.0.1"
cffi = "^1.15.1"
pre-commit = "^2.19.0"
pyinstaller = "^5.4.1"
httpx = "^0.23.0"
qrcode = "^7.4.2"
pytest-click = "^1.1.0"
pyinstaller = "^5.13.0"

[tool.poetry.dev-dependencies]
pytest = "6.2.5"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def test_chunk_upload(httpx_mock, mocker):
mocker.patch('app.services.file_manager.file_upload.models.FileObject.generate_meta', return_value=(1, 1))

test_obj = FileObject('test', 'test', 'test', 'test', 'test')
res = upload_client.upload_chunk(test_obj, 0, b'1')
res = upload_client.upload_chunk(test_obj, 0, b'1', 'test_etag')

assert test_obj.progress_bar.n == 1
assert res.status_code == 200
Expand Down