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

datasetRw Upload - naming and readMe #187

Merged
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
24 changes: 22 additions & 2 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,18 @@ For example: `f = open("authors.txt","rb")`

==== blobs_get(key)

Retrieve a file from the Domino server by blob key.

*_Deprecated_* Use get_blobs_v2. Retrieve a file from the Domino server by blob key.
* _key:_ The key of the file to fetch from the blob server.

==== blobs_get_v2(path, commit_id, project_id)

Retrieve a file from the Domino server in a project from its path and commit id.

* _path:_ The path to the file in the Domino project.
* _commit_id:_ ID of the commit to retrieve the file from.
* _project_id:_ ID of the project to retrieve the file from.

=== Apps

==== app_publish(unpublishRunningApps=True, hardwareTierId=None)
Expand Down Expand Up @@ -445,6 +453,18 @@ Delete a set of datasets.
NOTE: Datasets are first marked for deletion, then deleted after a grace period (15 minutes, configurable).
A Domino admin may also need to complete this process before the name can be reused.

==== datasets_upload_files(dataset_id, local_path_to_file_or_directory, file_upload_setting, max_workers, target_chunk_size, target_relative_path)

Uploads a file or entire directory to a dataset.

* _dataset_id:_ The dataset identifier.
* _local_path_to_file_or_directory:_ The path to the file or directory in local machine.
* _file_upload_setting:_ (Optional) The setting to resolve naming conflict, must be one of `Ignore`, `Rename`, `Overwrite` (default).
* _max_workers:_ (Optional) The max amount of threads (default: 10).
* _target_chunk_size:_ (Optional) The max chunk size for multipart upload (default: 8MB).
* _target_relative_path:_ (Optional) The path on the dataset to upload the file or directory to. Note that the path must exist or the upload will fail.


== Example

[source,python]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ Delete a set of datasets.
after a grace period (15 minutes, configurable). A Domino admin may
also need to complete this process before the name can be reused.

### datasets_upload_file(dataset_id, local_path_to_file_or_directory, file_upload_setting, max_workers, target_chunk_size, target_relative_path)
### datasets_upload_files(dataset_id, local_path_to_file_or_directory, file_upload_setting, max_workers, target_chunk_size, target_relative_path)

Uploads a file or entire directory to a dataset.

Expand Down
2 changes: 1 addition & 1 deletion domino/domino.py
Original file line number Diff line number Diff line change
Expand Up @@ -1048,7 +1048,7 @@ def datasets_remove(self, dataset_ids: list):
url = self._routes.datasets_details(dataset_id)
self.request_manager.delete(url)

def datasets_upload_file(
def datasets_upload_files(
self,
dataset_id: str,
local_path_to_file_or_directory: str,
Expand Down
6 changes: 3 additions & 3 deletions tests/test_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def test_datasets_upload(default_domino_client):
1
]
local_path_to_file = "test_datasets.py"
response = default_domino_client.datasets_upload_file(datasets_id, local_path_to_file)
response = default_domino_client.datasets_upload_files(datasets_id, local_path_to_file)

assert "test_datasets.py" in response

Expand All @@ -114,7 +114,7 @@ def test_datasets_upload_with_sub_dir(default_domino_client):
1
]
local_path_to_file = "test_datasets.py"
response = default_domino_client.datasets_upload_file(datasets_id, local_path_to_file, target_relative_path="sub_d")
response = default_domino_client.datasets_upload_files(datasets_id, local_path_to_file, target_relative_path="sub_d")

assert "test_datasets.py" in response

Expand All @@ -127,7 +127,7 @@ def test_datasets_upload_non_existing_file(default_domino_client):
]
local_path_to_file = "non_existing_file.py"
try:
default_domino_client.datasets_upload_file(datasets_id, local_path_to_file)
default_domino_client.datasets_upload_files(datasets_id, local_path_to_file)
assert False
except ValueError:
assert True
Expand Down