Ejemplo n.º 1
0
from hca.dss import DSSClient

dss = DSSClient()

checkout_id = dss.post_bundles_checkout(
    uuid="fff746b3-e3eb-496a-88a3-5fa1fa358392", replica="aws")
print(checkout_id)
Ejemplo n.º 2
0
dss.login(access_token=access_token)

# Refreshes Swagger document. Can help resolve errors communicate with the API.
dss.clear_cache()

# 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.