Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Idsse 1054 #91

Merged
merged 5 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 5 additions & 1 deletion python/idsse_common/idsse/common/aws_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ def ls(self, path: str, prepend_path: bool = True) -> Sequence[str]:
return [os.path.join(path, filename.split(' ')[-1]) for filename in commands_result]
return [filename.split(' ')[-1] for filename in commands_result]

def cp(self, path: str, dest: str, concurrency: int | None = None, chunk_size: int | None = None) -> bool:
def cp(self,
path: str,
dest: str,
concurrency: int | None = None,
chunk_size: int | None = None) -> bool:
"""Execute a 'cp' on the AWS s3 bucket specified by path, dest. Attempts to use
[s5cmd](https://github.com/peak/s5cmd) to copy the file from S3 with parallelization,
but falls back to (slower) aws-cli if s5cmd is not installed or throws an error.
Expand Down
6 changes: 5 additions & 1 deletion python/idsse_common/idsse/common/http_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ def ls(self, path: str, prepend_path: bool = True) -> Sequence[str]:
return files

# pylint: disable=unused-argument
def cp(self, path: str, dest: str, concurrency: int | None = None, chunk_size: int | None = None) -> bool:
def cp(self,
path: str,
dest: str,
concurrency: int | None = None,
chunk_size: int | None = None) -> bool:
"""Execute http request download from path to dest.

Args:
Expand Down
7 changes: 0 additions & 7 deletions python/idsse_common/test/test_http_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,6 @@ def test_ls_without_prepend_path(http_utils: HttpUtils, httpserver: HTTPServer):
assert len(result) == len(EXAMPLE_FILES)
assert result[0] == EXAMPLE_FILES[-1]


def test_ls_on_error(http_utils: HttpUtils, httpserver: HTTPServer):
httpserver.expect_request('/data/'+EXAMPLE_ENDPOINT).respond_with_data('', content_type="text/plain")
result = http_utils.ls(EXAMPLE_URL + EXAMPLE_ENDPOINT)
assert result == []


def test_cp_succeeds(http_utils: HttpUtils, httpserver: HTTPServer):
url = '/data/'+EXAMPLE_PROD_DIR+'/temp.grib2.gz'
httpserver.expect_request(url).respond_with_data(bytes([0,1,2]), status=200,
Expand Down
Loading
Loading