Beispiel #1
0
from hca.dss import DSSClient

dss = DSSClient()

bundle_checkout_status = dss.get_bundles_checkout(
    replica="aws", checkout_job_id="4de1c603-fa8b-4c07-af37-06159e6951e0")

print(f'Bundle checkout status: {bundle_checkout_status["status"]}!')
if bundle_checkout_status["status"] == "SUCCEEDED":
    print(f'File is located at: {bundle_checkout_status["location"]}')
Beispiel #2
0
# JSON query and returns matching bundle identifiers.
for results in dss.post_search.iterate(replica="aws", es_query={}):
    uuid, version = results["bundle_fqid"].split(".", 1)
    try:
        # Initiate asynchronous checkout of a bundle.
        # Output:
        # {
        #   "checkout_job_id": "6a7438be-3998-4f1b-807c-7848dceaf351"
        # }
        s = f"Bundle: {uuid}.{version}\n"
        checkout_id = dss.post_bundles_checkout(
            uuid=uuid, replica="aws")["checkout_job_id"]

        # A JSON response that displays status and/or location of checkout.
        bundle_checkout_status = dss.get_bundles_checkout(
            replica="aws", checkout_job_id=checkout_id)["status"]
        print(checkout_id + " " + bundle_checkout_status)

        # Download a bundle and save it to the local filesystem as a directory.
        dss.download(
            bundle_uuid=uuid,
            replica="aws",
            version=version,
            download_dir="./download_test",
        )

        # Retrieves a bundle given a UUID and optionally a version.
        files_uuid = []
        for file in dss.get_bundle:
            file_version = bundle["version"]
            file_uuid = bundle["uuid"]