Manages data storage for CKAN/DCOR (import, symlink, etc.)
Project description
This plugin manages how data are stored in DCOR. There are two types of files in DCOR:
Resources uploaded by users, imported from figshare, or imported from a data archive
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 via a background job. CKAN itself will not notice this. The idea is to have a filesystem overview about the datasets of each user.
A backround job that uploads resources to S3 in after_resource_create if the resources were uploaded via the legacy upload route.
A background job that backs up resources from S3 to local block storage if the resources were uploaded via the S3 upload route.
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
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file ckanext-dcor_depot-0.14.1.tar.gz
.
File metadata
- Download URL: ckanext-dcor_depot-0.14.1.tar.gz
- Upload date:
- Size: 34.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c867f846dd2df9b23d5a9ba39f20d0f546b2398663aef35d02a0efb2b19a4dea |
|
MD5 | 825dc71d2a8bc4268e28fc8833eb3631 |
|
BLAKE2b-256 | d04fc0e31420fc40971695c78f109d18d586ebb94875ad38c44e038e78b7c081 |
File details
Details for the file ckanext_dcor_depot-0.14.1-py3-none-any.whl
.
File metadata
- Download URL: ckanext_dcor_depot-0.14.1-py3-none-any.whl
- Upload date:
- Size: 36.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c61017a287c55282c348e3c7338cd106658bcb4087b7bba860bbba621eca4fef |
|
MD5 | 9600cb3eb2130454d34109b8ae005894 |
|
BLAKE2b-256 | f96d99d578019cd08a358871130a04f2211ef8bb447737debb5b93144f21de35 |