Giter Club home page Giter Club logo

Comments (1)

jmaupetit avatar jmaupetit commented on July 18, 2024

@SergioSim a draft implementation has been made in a Jupyter notebook. Parts of this draft implementation follows.

Requirements

  • python-keystoneclient
  • python-swiftclient

Configuration

Configure your OpenStack environment:

$ export OS_AUTH_URL="https://auth.cloud.ovh.net/"
$ export OS_TENANT_ID="xxx"
$ export OS_TENANT_NAME="xxx"
$ export OS_PASSWORD="xxx"
$ export OS_USERNAME="xxx"
$ export OS_LRS_CONTAINER_URL="xxx"```

Download archives

import logging
import os

from swiftclient.service import SwiftService, SwiftError
logging.basicConfig(level=logging.INFO)
logging.getLogger("requests").setLevel(logging.ERROR)
logging.getLogger("swiftclient").setLevel(logging.ERROR)
logger = logging.getLogger(__name__)


def download(container, objects, options=None):
    with SwiftService(options=options) as swift:
        try:
            for download in swift.download(container=container, objects=objects):
                if download['success']:
                    logger.info("Successfully downloaded: %s", download['object'])
                else:
                    logger.error("Failed to download: %s", download['object'])
        except SwiftError as e:
            logger.error(e.value)
            raise e

container = "lrs-xapi-statements"
archives = ["2020-04-29.gz", ]
options = {
    "os_storage_url": os.environ["OS_LRS_CONTAINER_URL"].replace(f"/{container}", "")
}

download(container, archives, options)

Swift client documentation: https://docs.openstack.org/python-swiftclient/latest/service-api.html

from ralph.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.