Unverified Commit a22d7187 authored by mvdbeek's avatar mvdbeek
Browse files

Add `__FETCH_DATA__` support for composite metadata

parent 23a623d9
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -6749,6 +6749,8 @@ export interface components {
            hashes?: components["schemas"]["FetchDatasetHash"][] | null;
            /** Info */
            info?: string | null;
            /** Metadata */
            metadata?: Record<string, never> | null;
            /** Name */
            name?: string | number | boolean | null;
            /**
+8 −0
Original line number Diff line number Diff line
@@ -80,6 +80,7 @@ class ModelPersistenceContext(metaclass=abc.ABCMeta):
        name,
        filename=None,
        extra_files=None,
        metadata=None,
        metadata_source_name=None,
        info=None,
        library_folder=None,
@@ -152,6 +153,12 @@ class ModelPersistenceContext(metaclass=abc.ABCMeta):
        if final_job_state == galaxy.model.Job.states.ERROR and not self.get_implicit_collection_jobs_association_id():
            primary_data.visible = True

        if metadata:
            for key, value in metadata.items():
                metadata_element = primary_data.datatype.metadata_spec.get(key)
                if metadata_element and metadata_element.set_in_upload:
                    setattr(primary_data.metadata, key, value)

        for source_dict in sources:
            source = galaxy.model.DatasetSource()
            source.source_uri = source_dict["source_uri"]
@@ -860,6 +867,7 @@ def persist_hdas(elements, model_persistence_context, final_job_state="ok"):
                    name=name,
                    filename=discovered_file.path,
                    extra_files=extra_files,
                    metadata=element.get("metadata"),
                    info=info,
                    tag_list=tag_list,
                    link_data=link_data,
+3 −0
Original line number Diff line number Diff line
import json
from enum import Enum
from typing import (
    Any,
    Dict,
    List,
    Optional,
    Union,
@@ -181,6 +183,7 @@ class PathDataElement(BaseDataElement):
class CompositeDataElement(BaseDataElement):
    src: Literal["composite"]
    composite: "CompositeItems"
    metadata: Optional[Dict[str, Any]] = None


class CompositeItems(FetchBaseModel):
+2 −0
Original line number Diff line number Diff line
@@ -122,6 +122,8 @@ class StagingInterface(metaclass=abc.ABCMeta):
                    for i, composite_data in enumerate(upload_target.composite_data):
                        composite_item_src = _attach_file(fetch_payload, composite_data, index=i)
                        composite_items.append(composite_item_src)
                    if "metadata" in upload_target.properties:
                        fetch_payload["targets"][0]["elements"][0]["metadata"] = upload_target.properties["metadata"]
                    fetch_payload["targets"][0]["elements"][0]["src"] = "composite"
                    fetch_payload["targets"][0]["elements"][0]["composite"] = {
                        "items": composite_items,
+2 −0
Original line number Diff line number Diff line
@@ -241,6 +241,8 @@ def galactic_job_json(
            kwd["decompress"] = value["decompress"]
        if value.get("hashes"):
            kwd["hashes"] = value["hashes"]
        if value.get("metadata"):
            kwd["metadata"] = value["metadata"]
        if composite_data_raw:
            composite_data = []
            for entry in composite_data_raw:
Loading