Skip to content

Commit

Permalink
add functions to get dataset templates details and to validate dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
Wrufesh committed Nov 20, 2023
1 parent bd03fcc commit 6d1bae2
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 8 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
## Accelerator python client
## Accelerator python client

# Build
Please follow [this link.](https://packaging.python.org/en/latest/tutorials/packaging-projects/)

50 changes: 44 additions & 6 deletions accli/AcceleratorProjectService.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,25 +221,63 @@ def abort_update_multipart_upload(self, bucket_object_id, upload_id):
),
headers=headers
)
# TODO @wrufesh ensure it requires special token
def register_iamc_validation(
self, validated_bucket_object_id, indexdb_bucket_object_id

# # TODO @wrufesh ensure it requires special token
# def register_iamc_validation(
# self, validated_bucket_object_id, indexdb_bucket_object_id
# ):

# headers = {"Content-Type": "application/json"}

# headers.update(self.common_request_headers)

# res = self.http_client_request(
# "PUT",
# f"{self.cli_base_url}/register-iamc-validation",
# json=dict(
# validated_bucket_object_id=validated_bucket_object_id,
# indexdb_bucket_object_id=indexdb_bucket_object_id
# ),
# headers=headers
# )

def register_validation(
self,
validated_bucket_object_id: int,
dataset_template_id: int,
validated_metadata: dict
):

headers = {"Content-Type": "application/json"}

headers.update(self.common_request_headers)

res = self.http_client_request(
"PUT",
f"{self.cli_base_url}/register-iamc-validation",
f"{self.cli_base_url}/register-validation",
json=dict(
validated_bucket_object_id=validated_bucket_object_id,
indexdb_bucket_object_id=indexdb_bucket_object_id
dataset_template_id=dataset_template_id,
validated_metadata=validated_metadata
),
headers=headers
)

def get_dataset_template_details(
self,
dataset_template_id
):
headers = {"Content-Type": "application/json"}

headers.update(self.common_request_headers)

res = self.http_client_request(
"GET",
f"{self.cli_base_url}/dataset-template-detail/{dataset_template_id}",
headers=headers
)

return res.json()



def read_part_data(self, stream, size, part_data=b"", progress=None):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "accli"
version = "0.1.1"
version = "0.1.2"
authors = [
{ name="Wrufesh S", email="[email protected]" },
]
Expand Down

0 comments on commit 6d1bae2

Please sign in to comment.