Skip to main content

Manages data storage for CKAN/DCOR (import, symlink, etc.)

Project description

PyPI Version Build Status Coverage Status

This plugin manages how data are stored in DCOR. There are two types of files in DCOR:

  1. Resources uploaded by users, imported from figshare, or imported from a data archive

  2. Ancillary files that are generated upon resource creation, such as condensed DC data, preview images (see ckanext-dc_view).

This plugin implements:

  • Data storage management. All resources uploaded by a user are moved to /data/users-HOSTNAME/USERNAME-ORGNAME/PK/ID/PKGNAME_RESID_RESNAME and symlinks are created in /data/ckan-HOSTNAME/resources/RES/OUR/CEID. CKAN itself will not notice this. The idea is to have a filesystem overview about the datasets of each user.

  • Import datasets from figshare. Existing datasets from figshare are downloaded to the /data/depots/figshare directory and, upon resource creation, symlinked there from /data/ckan-HOSTNAME/resources/RES/OUR/CEID (Note that this is an exemption of the data storage management described above). When running the following command, the “figshare-import” organization is created and the datasets listed in figshare_dois.txt are added to CKAN:

    ckan import-figshare
  • Populate an internal depot from RT-DC data stored in tar archives. This is part of an effort to have automated imports of RT-DC data from other sources. The idea is to move experimental data to the DCOR server in tar archives and DCOR can then populate the internal depot with it. The location of the internal depot is /data/depots/internal/ and it follows a very specific directory structure 201X/2019-08/20/2019-08-20_1126_c083de* where the path is generated from the acquisition date, time, and part of the hash (c083de) of the original data file. According to this scheme, all files with the same path stem belong to one dataset:

    • 2019-08-20_1126_c083de.sha256sums a file containing SHA256 sums

    • 2019-08-20_1126_c083de_v1.rtdc the actual measurement

    • 2019-08-20_1126_c083de_v1_condensed.rtdc the condensed dataset

    • 2019-08-20_1126_c083de_ad1_m001_bg.png an ancillary image

    • 2019-08-20_1126_c083de_ad2_m002_bg.png another ancillary image

    ckan depotize-archive
  • Import datasets from the internal depot. The previous command depotize-archive just populates the depot directory structure. To make the datasets available in CKAN, this step must be performed:

    ckan import-internal
  • Upgrade datasets from the internal depot. If you find issues or have to add new versions of an .rtdc resource, simply create the _v2.rtdc files and run this command:

    ckan upgrade-internal
  • CLI for symlinking datasets that have failed to symlink before:

    ckan run-jobs-dcor-depot
  • CLI for appending a resource to a dataset

    ckan append-resource /path/to/file dataset_id --delete-source

Please make sure that the necessary file permissions are given in /data.

In 2023, it was decided that the huge block storage of DCOR should be replaced with an S3-compatible object store, because block storage does not scale well. This partially deprecates some of the commands above which might be removed or modified to support object storage directly.

  • CLI for migrating data from block storage to an S3-compatible object storage service. For this, the following configuration keys must be specified in the ckan.ini file:

    dcor_object_store.access_key_id = ACCESS_KEY_ID
    dcor_object_store.secret_access_key = SECRET_ACCESS_KEY
    dcor_object_store.endpoint_url = S3_ENDPOINT_URL
    dcor_object_store.ssl_verify = true
    # The bucket name is by default defined by the circle ID. Resources
    # are stored in the "RES/OUR/CEID-SCHEME" in that bucket.
    dcor_object_store.bucket_name = circle-{organization_id}

    Usage:

    ckan dcor-migrate-resources-to-object-store

Installation

pip install ckanext-dcor_depot

Add this extension to the plugins and defaul_views in ckan.ini:

ckan.plugins = [...] dcor_depot
ckan.storage_path=/data/ckan-HOSTNAME
ckanext.dcor_depot.depots_path=/data/depots
ckanext.dcor_depot.users_depot_name=users-HOSTNAME

This plugin stores resources to /data:

mkdir -p /data/depots/users-$(hostname)
chown -R www-data /data/depots/users-$(hostname)

Testing

If CKAN/DCOR is installed and setup for testing, this extension can be tested with pytest:

pytest ckanext

Testing can also be done via vagrant in a virtualmachine using the dcor-test <https://app.vagrantup.com/paulmueller/boxes/dcor-test/> image. Make sure that vagrant and virtualbox are installed and run the following commands in the root of this repository:

# Setup virtual machine using `Vagrantfile`
vagrant up
# Run the tests
vagrant ssh -- sudo bash /testing/vagrant-run-tests.sh

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ckanext-dcor_depot-0.13.2.tar.gz (51.0 kB view details)

Uploaded Source

Built Distribution

ckanext_dcor_depot-0.13.2-py3-none-any.whl (61.5 kB view details)

Uploaded Python 3

File details

Details for the file ckanext-dcor_depot-0.13.2.tar.gz.

File metadata

  • Download URL: ckanext-dcor_depot-0.13.2.tar.gz
  • Upload date:
  • Size: 51.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for ckanext-dcor_depot-0.13.2.tar.gz
Algorithm Hash digest
SHA256 97b20aff7ee7c9cba8836a698bbb94a27886cae7a55a9e6a2f2dc13ff5f1e4bb
MD5 60ab3c83e416ec8976721179b8028257
BLAKE2b-256 0f4d65ee5fb7a6072ce76ccf1debc493c7d52ca2f598015868d8e84184c23020

See more details on using hashes here.

File details

Details for the file ckanext_dcor_depot-0.13.2-py3-none-any.whl.

File metadata

File hashes

Hashes for ckanext_dcor_depot-0.13.2-py3-none-any.whl
Algorithm Hash digest
SHA256 eac352574e8bda748596e62094bf4be87b41e2e9f22a550d91e114aad9e6842a
MD5 ea70864acaf32a44e6ec95e98b5cb1a2
BLAKE2b-256 56f1992ef815fda2e97fbb32a333eae5eb3ae47b23230730379dc49797196b8c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page