From 787012ada588af7d5c6172a79373b2126b67e9f2 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Wed, 25 Sep 2024 10:11:48 -0400 Subject: [PATCH] WIP: landing library -> catalog --- lib/galaxy/tool_util/client/landing.py | 30 +++++++++---------- .../client/landing_library.catalog.yml | 21 +++++++++++++ .../client/landing_library.sample.yml | 13 -------- 3 files changed, 36 insertions(+), 28 deletions(-) create mode 100644 lib/galaxy/tool_util/client/landing_library.catalog.yml delete mode 100644 lib/galaxy/tool_util/client/landing_library.sample.yml diff --git a/lib/galaxy/tool_util/client/landing.py b/lib/galaxy/tool_util/client/landing.py index 9519686ad59a..425559a87ffa 100644 --- a/lib/galaxy/tool_util/client/landing.py +++ b/lib/galaxy/tool_util/client/landing.py @@ -23,15 +23,15 @@ RANDOM_SECRET_LENGTH = 10 -def load_default_library(): - library_yaml = resource_string("galaxy.tool_util.client", "landing_library.sample.yml") - return yaml.safe_load(library_yaml) +def load_default_catalog(): + catalog_yaml = resource_string("galaxy.tool_util.client", "landing_catalog.sample.yml") + return yaml.safe_load(catalog_yaml) @dataclass class Request: template_id: str - library: str + catalog: str client_secret: Optional[str] galaxy_url: str @@ -43,19 +43,19 @@ class Response: def generate_claim_url(request: Request) -> Response: template_id = request.template_id - library_path = request.library + catalog_path = request.catalog galaxy_url = request.galaxy_url client_secret = request.client_secret if client_secret == "__GEN__": client_secret = "".join( random.choice(string.ascii_lowercase + string.digits) for _ in range(RANDOM_SECRET_LENGTH) ) - if library_path: - with open(library_path) as f: - library = yaml.safe_load(f) + if catalog_path: + with open(catalog_path) as f: + catalog = yaml.safe_load(f) else: - library = load_default_library() - template = library[template_id] + catalog = load_default_catalog() + template = catalog[template_id] template_type = "tool" if "tool_id" in template else "workflow" if client_secret: template["client_secret"] = client_secret @@ -84,11 +84,11 @@ def arg_parser() -> argparse.ArgumentParser: help="Galxy target for the landing request", ) parser.add_argument( - "-l", - "--library", - dest="library", + "-c", + "--catalog", + dest="catalog", default=None, - help="YAML library to load landing request templates from.", + help="YAML catalog to load landing request templates from.", ) parser.add_argument( "-s", @@ -107,7 +107,7 @@ def main(argv=None) -> None: args = arg_parser().parse_args(argv) request = Request( args.template_id, - args.library, + args.catalog, args.secret, args.galaxy_url, ) diff --git a/lib/galaxy/tool_util/client/landing_library.catalog.yml b/lib/galaxy/tool_util/client/landing_library.catalog.yml new file mode 100644 index 000000000000..71a1c6e03f62 --- /dev/null +++ b/lib/galaxy/tool_util/client/landing_library.catalog.yml @@ -0,0 +1,21 @@ +# Catalog of artifacts that the landing script can generate landing URLs for against +# the target Galaxy. +simple_workflow: + # Encoded ID for a workflow to target - if workflow_target_type is stored_workflow this + # will always be the latest version of that workflow and stored workflow ID should be provided. + # If instead workflow_target_type is workflow - this is a particular version of a workflow and + # the workflow ID should be provided. + workflow_id: f2db41e1fa331b3e + workflow_target_type: stored_workflow + # request state provides prepopulated parameters for this workflow or stored workflow when the + # user navigates to the landing URL. + request_state: + myinput: + src: url + url: https://raw.githubusercontent.com/galaxyproject/galaxy/dev/test-data/1.bed + ext: txt +int_workflow: + workflow_id: f597429621d6eb2b + workflow_target_type: stored_workflow + request_state: + int_input: 8 diff --git a/lib/galaxy/tool_util/client/landing_library.sample.yml b/lib/galaxy/tool_util/client/landing_library.sample.yml deleted file mode 100644 index d5d505a8f102..000000000000 --- a/lib/galaxy/tool_util/client/landing_library.sample.yml +++ /dev/null @@ -1,13 +0,0 @@ -simple_workflow: - workflow_id: f2db41e1fa331b3e - workflow_target_type: stored_workflow - request_state: - myinput: - src: url - url: https://raw.githubusercontent.com/galaxyproject/galaxy/dev/test-data/1.bed - ext: txt -int_workflow: - workflow_id: f597429621d6eb2b - workflow_target_type: stored_workflow - request_state: - int_input: 8