diff --git a/artifacts/download_dataset.yaml b/artifacts/download_dataset.yaml new file mode 100644 index 0000000..706f21e --- /dev/null +++ b/artifacts/download_dataset.yaml @@ -0,0 +1,21 @@ +--- +- name: Install datahugger and download dataset + hosts: localhost + vars: + ansible_python_interpreter: /usr/bin/python3 + tasks: + - name: Ensure python3-pip is installed + ansible.builtin.package: + name: python3-pip + state: present + + - name: Install datahugger Python module + ansible.builtin.pip: + name: datahugger + state: present + executable: pip3 + + - name: Download the dataset + grycap.dataset.download_dataset: + dataset_url: "{{ dataset_url }}" + output_dir: "{{ output_dir }}" diff --git a/custom_types.yaml b/custom_types.yaml index f9eeaf1..2a7d9d2 100644 --- a/custom_types.yaml +++ b/custom_types.yaml @@ -114,6 +114,39 @@ data_types: type: string required: no + tosca.datatypes.Dataset: + derived_from: tosca.datatypes.Root + description: A data type that represents a dataset, including its DOI and other metadata. + properties: + identifier: + type: string + description: The Digital Object Identifier of the dataset. + required: true + title: + type: string + description: The title of the dataset. + required: false + description: + type: string + description: A description of the dataset. + required: false + creator: + type: string + description: The creator of the dataset. + required: false + release_date: + type: string + description: The publication date of the dataset. + required: false + downloadURL: + type: string + description: The URL to download the dataset. + required: false + license: + type: string + description: A legal document under which the resource is made available. + required: false + capability_types: tosca.capabilities.indigo.OperatingSystem: @@ -1894,6 +1927,38 @@ node_types: valid_source_types: [tosca.nodes.Container.Application.Docker] relationship: tosca.relationships.HostedOn + tosca.nodes.eosc.Dataset: + derived_from: tosca.nodes.Root + properties: + dataset: + type: tosca.datatypes.Dataset + description: The dataset associated with this node. + required: true + filter: + type: string + description: Regex to express the set of files to get from the Dataset. + required: false + dest: + type: string + description: Path to download the set of files from the Dataset. + required: false + requirements: + - host: + capability: tosca.capabilities.Compute + node: tosca.nodes.Compute + relationship: tosca.relationships.HostedOn + artifacts: + datase_collection: + file: git+https://github.com/grycap/ansible-collection-dataset + type: tosca.artifacts.AnsibleGalaxy.collection + interfaces: + Standard: + configure: + implementation: https://raw.githubusercontent.com/grycap/tosca/datasets/artifacts/lrms/download_dataset.yaml + inputs: + dataset_url: { get_property: [ SELF, dataset, identifier ] } + output_dir: { get_property: [ SELF, dest ] } + policy_types: tosca.policies.indigo.Placement: diff --git a/tests/requirements.yaml b/tests/requirements.yaml index 3a1cd9a..2969b11 100644 --- a/tests/requirements.yaml +++ b/tests/requirements.yaml @@ -32,5 +32,8 @@ roles: collections: - name: community.crypto + - name: grycap.dataset + source: https://github.com/grycap/ansible-collection-dataset + type: git - name: community.docker version: 3.12.2