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

feat(params): use binary file-upload if file is large #72

Merged
merged 23 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
8881fe5
Merge pull request #24 from rapyuta-robotics/devel
ankitrgadiya Sep 16, 2022
bc4f278
chore(release): 1.5.0 [skip ci]
semantic-release-bot Sep 16, 2022
6969b6f
Merge pull request #29 from rapyuta-robotics/devel
ankitrgadiya Oct 25, 2022
3736967
Merge pull request #30 from rapyuta-robotics/devel
amitsingh21 Oct 27, 2022
2b6cde8
Merge pull request #32 from rapyuta-robotics/devel
amitsingh21 Oct 27, 2022
00ef54f
Merge pull request #34 from rapyuta-robotics/devel
ankitrgadiya Dec 14, 2022
bc93b87
Merge pull request #36 from rapyuta-robotics/devel
ankitrgadiya Dec 14, 2022
f4c5a8a
chore(release): 1.7.0 [skip ci]
semantic-release-bot Dec 14, 2022
9ef5ada
Merge pull request #38 from rapyuta-robotics/devel
ankitrgadiya Feb 7, 2023
f1c11c7
chore(release): 1.8.0 [skip ci]
semantic-release-bot Feb 7, 2023
bb2dd37
Merge pull request #49 from rapyuta-robotics/devel
ankitrgadiya Apr 19, 2023
4b5569e
chore(release): 1.9.0 [skip ci]
semantic-release-bot Apr 19, 2023
4e0739f
Merge pull request #55 from rapyuta-robotics/devel
pallabpain May 31, 2023
26864f6
chore(release): 1.10.0 [skip ci]
semantic-release-bot May 31, 2023
5573944
Merge pull request #61 from rapyuta-robotics/devel
pallabpain Jul 13, 2023
8b82b8b
chore(release): 1.11.0 [skip ci]
ankitrgadiya Jul 14, 2023
1b1a1e4
Merge pull request #63 from rapyuta-robotics/devel
pallabpain Jul 27, 2023
9b0433e
chore(release): 1.11.1 [skip ci]
semantic-release-bot Jul 27, 2023
d1ab2ca
Merge pull request #67 from rapyuta-robotics/devel
ankitrgadiya Sep 26, 2023
b6b3682
chore(release): 1.12.0 [skip ci]
semantic-release-bot Sep 26, 2023
53560aa
Merge pull request #71 from rapyuta-robotics/devel
pallabpain Dec 13, 2023
e42ad6e
chore(release): 1.13.0 [skip ci]
semantic-release-bot Dec 13, 2023
f276b33
feat(params): use binary file-upload if file is large
ankitrgadiya Dec 29, 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
65 changes: 65 additions & 0 deletions CHANGELOG/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,68 @@
# [1.13.0](https://github.com/rapyuta-robotics/rapyuta-io-sdk/compare/v1.12.0...v1.13.0) (2023-12-13)


### Features

* **device:** accepts feature config in toggle_features ([#70](https://github.com/rapyuta-robotics/rapyuta-io-sdk/issues/70)) ([a293787](https://github.com/rapyuta-robotics/rapyuta-io-sdk/commit/a2937874d500633c79497cfc8414ed5f09e32137))

# [1.12.0](https://github.com/rapyuta-robotics/rapyuta-io-sdk/compare/v1.11.1...v1.12.0) (2023-09-26)


### Features

* **usergroup:** supports user group role in projects ([4f6c34f](https://github.com/rapyuta-robotics/rapyuta-io-sdk/commit/4f6c34fd713cb493c6b44225d566e90afe8f88fa))

## [1.11.1](https://github.com/rapyuta-robotics/rapyuta-io-sdk/compare/v1.11.0...v1.11.1) (2023-07-27)


### Bug Fixes

* **package:** makes dependent deployment ready phase configurable ([e0df4ec](https://github.com/rapyuta-robotics/rapyuta-io-sdk/commit/e0df4ecab55a2defd47cae6446dda7f48e7e9f42))

# [1.11.0](https://github.com/rapyuta-robotics/rapyuta-io-sdk/compare/v1.10.0...v1.11.0) (2023-07-14)

### Features

* **deployment**: adds update_deployment API ([51c14af74c3377585c56c025cb99af12bc90910d](https://github.com/rapyuta-robotics/rapyuta-io-sdk/commit/51c14af74c3377585c56c025cb99af12bc90910d))
* **deployment**: made poll deployment till ready phase configurable ([763716c](https://github.com/rapyuta-robotics/rapyuta-io-sdk/commit/763716c47c426a513f4f9eb522419086a37349bc))
* **usergroup**: implements usergroup APIS ([6d9037e](https://github.com/rapyuta-robotics/rapyuta-io-sdk/commit/6d9037eb162e8854e0595dcf4caf3caf11c7980a))

# [1.10.0](https://github.com/rapyuta-robotics/rapyuta-io-sdk/compare/v1.9.0...v1.10.0) (2023-05-31)


### Features

* **rip:** adds support for token_level in get_auth_token ([88fcc69](https://github.com/rapyuta-robotics/rapyuta-io-sdk/commit/88fcc697842de856a031a370f8ab630047532f49))

# [1.9.0](https://github.com/rapyuta-robotics/rapyuta-io-sdk/compare/v1.8.0...v1.9.0) (2023-04-19)


### Bug Fixes

* **metrics:** tags schema and its unit tests ([6cf652b](https://github.com/rapyuta-robotics/rapyuta-io-sdk/commit/6cf652b177fb7c722a037ff9498c845ee12a6ff1))
* **rosbags:** integration-test for throttling ([3cd2cd6](https://github.com/rapyuta-robotics/rapyuta-io-sdk/commit/3cd2cd6d1ed1ca3a6b4beb050865dcedb56b4c45))


### Features

* **device:** adds API to toggle features ([39860fc](https://github.com/rapyuta-robotics/rapyuta-io-sdk/commit/39860fc05a7a261862a2738ca1d9c7af546a0f6f))
* **network:** allows custom resource limits for cloud networks ([e58f0c5](https://github.com/rapyuta-robotics/rapyuta-io-sdk/commit/e58f0c5c33ddd0f860210cc9a74cb6e6cf9ef6b9))
* **parameters:** adds the option to upload arbitrary directories as config ([4c95e96](https://github.com/rapyuta-robotics/rapyuta-io-sdk/commit/4c95e96db054bbc5fba615edafd586d65a9b7a5a))

# [1.8.0](https://github.com/rapyuta-robotics/rapyuta-io-sdk/compare/v1.7.0...v1.8.0) (2023-02-07)


### Features

* **rosbag:** fetches rosbag job by guid ([3d93c6e](https://github.com/rapyuta-robotics/rapyuta-io-sdk/commit/3d93c6e2f8c1d4e6bda7de2815b1ec3a1001bdc9))

# [1.7.0](https://github.com/rapyuta-robotics/rapyuta-io-sdk/compare/v1.6.1...v1.7.0) (2022-12-14)


### Features

* **rosbags:** adds support for splitting rosbags by duration ([3770e00](https://github.com/rapyuta-robotics/rapyuta-io-sdk/commit/3770e00a7d95d6ca8699185a96bf6941a29c3875))

# [1.6.0](https://github.com/rapyuta-robotics/rapyuta-io-sdk/compare/v1.5.0...v1.6.0) (2022-10-27)
### Features
- **device:** Added support for throttling and latching of rosbags
Expand Down
2 changes: 1 addition & 1 deletion rapyuta_io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
from .clients.rosbag import UploadOptions
from .clients.user_group import UserGroup

__version__ = "1.6.0"
__version__ = "1.13.0"
16 changes: 14 additions & 2 deletions rapyuta_io/clients/paramserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
validate_list_of_strings
import six


class _Node(str, enum.Enum):

def __str__(self):
Expand All @@ -36,6 +35,8 @@ class _ParamserverClient:
yaml_content_type = 'text/yaml'
json_content_type = 'application/json'
default_binary_content_type = "application/octet-stream"
max_non_binary_size = 128 * 1024


def __init__(self, auth_token, project, core_api_host):
self._auth_token = auth_token
Expand Down Expand Up @@ -69,6 +70,11 @@ def create_binary_file(self, tree_path, file_path, retry_limit=0):
if guessed_content_type[1]:
headers['Content-Encoding'] = guessed_content_type[1]

# Override Content-Type for JSON and YAML to allow creating Binary files.
# This is required for large YAML/JSON files.
if content_type in (self.json_content_type, self.yaml_content_type):
content_type = self.default_binary_content_type

headers.update({'X-Rapyuta-Params-Version': "0",
'Content-Type': content_type})

Expand Down Expand Up @@ -129,7 +135,10 @@ def process_dir(self, executor, rootdir, tree_path, level, dir_futures, file_fut
future = executor.submit(func, new_tree_path)
dir_futures[future] = (new_tree_path, level + 1)
elif not in_attribute_dir: # ignore files in attribute directories
file_stat = os.stat(full_path)
file_name = os.path.basename(full_path)
if file_stat.st_size > self.max_non_binary_size:
future = executor.submit(self.create_binary_file, new_tree_path, full_path)
if file_name.endswith('.yaml'):
with open(full_path, 'r') as f:
data = f.read()
Expand All @@ -151,8 +160,11 @@ def process_folder(self, executor, rootdir, tree_path, level, dir_futures, file_
future = executor.submit(self.create_folder, new_tree_path)
dir_futures[future] = (new_tree_path, level + 1)
else:
file_stat = os.stat(full_path)
file_name = os.path.basename(full_path)
if file_name.endswith('.yaml'):
if file_stat.st_size > self.max_non_binary_size:
future = executor.submit(self.create_binary_file, new_tree_path, full_path)
elif file_name.endswith('.yaml'):
with open(full_path, 'r') as f:
data = f.read()
future = executor.submit(self.create_file, new_tree_path, data)
Expand Down
Loading