Loading lib/galaxy/tool_util/client/staging.py +3 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ import os from typing import ( Any, BinaryIO, Callable, Dict, List, Optional, Loading Loading @@ -85,6 +86,7 @@ class StagingInterface(metaclass=abc.ABCMeta): use_path_paste: bool = LOAD_TOOLS_FROM_PATH, to_posix_lines: bool = True, job_dir: str = ".", resolve_data: Optional[Callable[[str], Optional[str]]] = None, ) -> Tuple[Dict[str, Any], List[Dict[str, Any]]]: def upload_func_fetch(upload_target: UploadTarget) -> Dict[str, Any]: def _attach_file(upload_payload: Dict[str, Any], uri: str, index: int = 0) -> Dict[str, Union[str, bool]]: Loading Loading @@ -271,6 +273,7 @@ class StagingInterface(metaclass=abc.ABCMeta): upload, create_collection_func, tool_or_workflow, resolve_data=resolve_data, ) # extension point for planemo to override logging Loading lib/galaxy/tool_util/cwl/util.py +9 −5 Original line number Diff line number Diff line Loading @@ -100,11 +100,14 @@ def _handle_pseudo_location(properties, pseudo_location): properties["location"] = properties["basename"] def abs_path_or_uri(path_or_uri: str, relative_to: str) -> str: def abs_path_or_uri(path_or_uri: str, relative_to: str, resolve_data: Optional[Callable[[str], Optional[str]]]) -> str: """Return the absolute path if this isn't a URI, otherwise keep the URI the same.""" if "://" in path_or_uri: return path_or_uri abs_path_ = os.path.abspath(os.path.join(relative_to, path_or_uri)) if resolve_data and not os.path.exists(abs_path_): if resolved_data := resolve_data(path_or_uri): abs_path_ = resolved_data _ensure_file_exists(abs_path_) return abs_path_ Loading Loading @@ -136,6 +139,7 @@ def galactic_job_json( upload_func: Callable[["UploadTarget"], Dict[str, Any]], collection_create_func: Callable[[List[Dict[str, Any]], str], Dict[str, Any]], tool_or_workflow: Literal["tool", "workflow"] = "workflow", resolve_data: Optional[Callable[[str], Optional[str]]] = None, ) -> Tuple[Dict[str, Any], List[Dict[str, Any]]]: """Adapt a CWL job object to the Galaxy API. Loading @@ -159,7 +163,7 @@ def galactic_job_json( return {"src": "hda", "id": dataset_id} def upload_file(file_path: str, secondary_files: Optional[str], **kwargs) -> Dict[str, str]: file_path = abs_path_or_uri(file_path, test_data_directory) file_path = abs_path_or_uri(file_path, test_data_directory, resolve_data=resolve_data) target = FileUploadTarget(file_path, secondary_files, **kwargs) upload_response = upload_func(target) return response_to_hda(target, upload_response) Loading @@ -170,17 +174,17 @@ def galactic_job_json( return response_to_hda(target, upload_response) def upload_tar(file_path: str, file_type: str = "directory", name: str = "uploaded tar file") -> Dict[str, str]: file_path = abs_path_or_uri(file_path, test_data_directory) file_path = abs_path_or_uri(file_path, test_data_directory, resolve_data=resolve_data) target = DirectoryUploadTarget(file_path, file_type=file_type, name=name) upload_response = upload_func(target) return response_to_hda(target, upload_response) def upload_file_with_composite_data(file_path: Optional[str], composite_data, **kwargs) -> Dict[str, str]: if file_path is not None: file_path = abs_path_or_uri(file_path, test_data_directory) file_path = abs_path_or_uri(file_path, test_data_directory, resolve_data=resolve_data) composite_data_resolved = [] for cd in composite_data: composite_data_resolved.append(abs_path_or_uri(cd, test_data_directory)) composite_data_resolved.append(abs_path_or_uri(cd, test_data_directory, resolve_data=resolve_data)) target = FileUploadTarget(file_path, composite_data=composite_data_resolved, **kwargs) upload_response = upload_func(target) return response_to_hda(target, upload_response) Loading lib/galaxy/tool_util/verify/interactor.py +12 −1 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ from galaxy.tool_util.parser.interface import ( ToolSourceTestOutputs, XmlTestCollectionDefDict, ) from galaxy.tool_util.verify.test_data import TestDataResolver from galaxy.util import requests from galaxy.util.bunch import Bunch from galaxy.util.hash_util import ( Loading Loading @@ -145,6 +146,7 @@ def stage_data_in_history( force_path_paste=False, maxseconds=DEFAULT_TOOL_TEST_WAIT, tool_version=None, test_data_resolver: Optional[TestDataResolver] = None, ): assert tool_id Loading @@ -155,7 +157,14 @@ def stage_data_in_history( test_data=test_data, tool_id=tool_id, force_path_paste=force_path_paste, tool_version=tool_version ) job[test_data["fname"]] = test_dict staging_interface.stage("tool", history_id=history, job=job, use_path_paste=force_path_paste) resolve_data = test_data_resolver.get_filename if test_data_resolver else None staging_interface.stage( "tool", history_id=history, job=job, use_path_paste=force_path_paste, resolve_data=resolve_data, ) galaxy_interactor.uploads = job return Loading Loading @@ -1312,6 +1321,7 @@ def verify_tool( skip_with_reference_data: bool = False, skip_on_dynamic_param_errors: bool = False, _tool_test_dicts: Optional[List[ToolTestDescriptionDict]] = None, # extension point only for tests test_data_resolver: Optional[TestDataResolver] = None, ): if resource_parameters is None: resource_parameters = {} Loading Loading @@ -1382,6 +1392,7 @@ def verify_tool( force_path_paste=force_path_paste, maxseconds=maxseconds, tool_version=tool_version, test_data_resolver=test_data_resolver, ) except Exception as e: input_staging_exception = e Loading lib/galaxy_test/base/populators.py +1 −0 Original line number Diff line number Diff line Loading @@ -3434,6 +3434,7 @@ def stage_inputs( job=job, use_path_paste=use_path_paste, to_posix_lines=to_posix_lines, resolve_data=galaxy_interactor._find_in_test_data_directories, **kwds, ) Loading lib/galaxy_test/driver/driver_util.py +2 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ from galaxy.tool_util.verify.interactor import ( GalaxyInteractorApi, verify_tool, ) from galaxy.tool_util.verify.test_data import TestDataResolver from galaxy.util import ( asbool, download_to_file, Loading Loading @@ -965,6 +966,7 @@ class GalaxyTestDriver(TestDriver): test_index=index, galaxy_interactor=galaxy_interactor, resource_parameters=resource_parameters, test_data_resolver=TestDataResolver(), **kwd, ) Loading Loading
lib/galaxy/tool_util/client/staging.py +3 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ import os from typing import ( Any, BinaryIO, Callable, Dict, List, Optional, Loading Loading @@ -85,6 +86,7 @@ class StagingInterface(metaclass=abc.ABCMeta): use_path_paste: bool = LOAD_TOOLS_FROM_PATH, to_posix_lines: bool = True, job_dir: str = ".", resolve_data: Optional[Callable[[str], Optional[str]]] = None, ) -> Tuple[Dict[str, Any], List[Dict[str, Any]]]: def upload_func_fetch(upload_target: UploadTarget) -> Dict[str, Any]: def _attach_file(upload_payload: Dict[str, Any], uri: str, index: int = 0) -> Dict[str, Union[str, bool]]: Loading Loading @@ -271,6 +273,7 @@ class StagingInterface(metaclass=abc.ABCMeta): upload, create_collection_func, tool_or_workflow, resolve_data=resolve_data, ) # extension point for planemo to override logging Loading
lib/galaxy/tool_util/cwl/util.py +9 −5 Original line number Diff line number Diff line Loading @@ -100,11 +100,14 @@ def _handle_pseudo_location(properties, pseudo_location): properties["location"] = properties["basename"] def abs_path_or_uri(path_or_uri: str, relative_to: str) -> str: def abs_path_or_uri(path_or_uri: str, relative_to: str, resolve_data: Optional[Callable[[str], Optional[str]]]) -> str: """Return the absolute path if this isn't a URI, otherwise keep the URI the same.""" if "://" in path_or_uri: return path_or_uri abs_path_ = os.path.abspath(os.path.join(relative_to, path_or_uri)) if resolve_data and not os.path.exists(abs_path_): if resolved_data := resolve_data(path_or_uri): abs_path_ = resolved_data _ensure_file_exists(abs_path_) return abs_path_ Loading Loading @@ -136,6 +139,7 @@ def galactic_job_json( upload_func: Callable[["UploadTarget"], Dict[str, Any]], collection_create_func: Callable[[List[Dict[str, Any]], str], Dict[str, Any]], tool_or_workflow: Literal["tool", "workflow"] = "workflow", resolve_data: Optional[Callable[[str], Optional[str]]] = None, ) -> Tuple[Dict[str, Any], List[Dict[str, Any]]]: """Adapt a CWL job object to the Galaxy API. Loading @@ -159,7 +163,7 @@ def galactic_job_json( return {"src": "hda", "id": dataset_id} def upload_file(file_path: str, secondary_files: Optional[str], **kwargs) -> Dict[str, str]: file_path = abs_path_or_uri(file_path, test_data_directory) file_path = abs_path_or_uri(file_path, test_data_directory, resolve_data=resolve_data) target = FileUploadTarget(file_path, secondary_files, **kwargs) upload_response = upload_func(target) return response_to_hda(target, upload_response) Loading @@ -170,17 +174,17 @@ def galactic_job_json( return response_to_hda(target, upload_response) def upload_tar(file_path: str, file_type: str = "directory", name: str = "uploaded tar file") -> Dict[str, str]: file_path = abs_path_or_uri(file_path, test_data_directory) file_path = abs_path_or_uri(file_path, test_data_directory, resolve_data=resolve_data) target = DirectoryUploadTarget(file_path, file_type=file_type, name=name) upload_response = upload_func(target) return response_to_hda(target, upload_response) def upload_file_with_composite_data(file_path: Optional[str], composite_data, **kwargs) -> Dict[str, str]: if file_path is not None: file_path = abs_path_or_uri(file_path, test_data_directory) file_path = abs_path_or_uri(file_path, test_data_directory, resolve_data=resolve_data) composite_data_resolved = [] for cd in composite_data: composite_data_resolved.append(abs_path_or_uri(cd, test_data_directory)) composite_data_resolved.append(abs_path_or_uri(cd, test_data_directory, resolve_data=resolve_data)) target = FileUploadTarget(file_path, composite_data=composite_data_resolved, **kwargs) upload_response = upload_func(target) return response_to_hda(target, upload_response) Loading
lib/galaxy/tool_util/verify/interactor.py +12 −1 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ from galaxy.tool_util.parser.interface import ( ToolSourceTestOutputs, XmlTestCollectionDefDict, ) from galaxy.tool_util.verify.test_data import TestDataResolver from galaxy.util import requests from galaxy.util.bunch import Bunch from galaxy.util.hash_util import ( Loading Loading @@ -145,6 +146,7 @@ def stage_data_in_history( force_path_paste=False, maxseconds=DEFAULT_TOOL_TEST_WAIT, tool_version=None, test_data_resolver: Optional[TestDataResolver] = None, ): assert tool_id Loading @@ -155,7 +157,14 @@ def stage_data_in_history( test_data=test_data, tool_id=tool_id, force_path_paste=force_path_paste, tool_version=tool_version ) job[test_data["fname"]] = test_dict staging_interface.stage("tool", history_id=history, job=job, use_path_paste=force_path_paste) resolve_data = test_data_resolver.get_filename if test_data_resolver else None staging_interface.stage( "tool", history_id=history, job=job, use_path_paste=force_path_paste, resolve_data=resolve_data, ) galaxy_interactor.uploads = job return Loading Loading @@ -1312,6 +1321,7 @@ def verify_tool( skip_with_reference_data: bool = False, skip_on_dynamic_param_errors: bool = False, _tool_test_dicts: Optional[List[ToolTestDescriptionDict]] = None, # extension point only for tests test_data_resolver: Optional[TestDataResolver] = None, ): if resource_parameters is None: resource_parameters = {} Loading Loading @@ -1382,6 +1392,7 @@ def verify_tool( force_path_paste=force_path_paste, maxseconds=maxseconds, tool_version=tool_version, test_data_resolver=test_data_resolver, ) except Exception as e: input_staging_exception = e Loading
lib/galaxy_test/base/populators.py +1 −0 Original line number Diff line number Diff line Loading @@ -3434,6 +3434,7 @@ def stage_inputs( job=job, use_path_paste=use_path_paste, to_posix_lines=to_posix_lines, resolve_data=galaxy_interactor._find_in_test_data_directories, **kwds, ) Loading
lib/galaxy_test/driver/driver_util.py +2 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ from galaxy.tool_util.verify.interactor import ( GalaxyInteractorApi, verify_tool, ) from galaxy.tool_util.verify.test_data import TestDataResolver from galaxy.util import ( asbool, download_to_file, Loading Loading @@ -965,6 +966,7 @@ class GalaxyTestDriver(TestDriver): test_index=index, galaxy_interactor=galaxy_interactor, resource_parameters=resource_parameters, test_data_resolver=TestDataResolver(), **kwd, ) Loading