Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Idea: hierarchy of var_templates #334

Closed
nsheff opened this issue Jun 22, 2021 · 4 comments
Closed

Idea: hierarchy of var_templates #334

nsheff opened this issue Jun 22, 2021 · 4 comments

Comments

@nsheff
Copy link
Contributor

nsheff commented Jun 22, 2021

Right now we have var_templates in the pipeline interface, which populates jinja templates. These are useful to provide parameters to plugins, but the names can potentially clash since they're not namespaced by plugin.

I propose that var templates should accept a hierarchy, so I can do somethign like:

var_templates:
  refgenie_plugin:
    config_path: "..."
  custom_template_plugin:
     config_path: "..."

As is, two plugins can't have the same parameter name, which isn't ideal.

@nsheff
Copy link
Contributor Author

nsheff commented Apr 24, 2023

@donaldcampbelljr you've been looking at var_templates recently; what do you think of this feature proposal?

@nsheff nsheff added this to the v2.0.0 milestone Feb 16, 2024
@donaldcampbelljr
Copy link
Contributor

Looking into this issue, I had to remind myself what are var_templates. The documentation exists but is sparse and without concrete examples. Hello Looper has a couple of pipeline interfaces that use them but they are not highlighted anywhere in the documentation.

As a reminder, here are two pipeline_interfaces:

Example using var_templates:

pipeline_name: example_pipeline  
pipeline_type: sample   
output_schema: output_schema.yaml  
var_templates:  
  path: "{looper.piface_dir}/pipelines/pipeline1.py"  
command_template: >  
  {pipeline.var_templates.path} --sample-name {sample.sample_name} --req-attr {sample.attr} 

Without using var_templates:

pipeline_name: example_pipeline  
pipeline_type: sample  
output_schema: output_schema.yaml  
command_template: >  
  python {looper.piface_dir}/count_lines.py {sample.file} {sample.sample_name} {pipestat.results_file}

We would like to enable hierarchy to var_templates such that we could do something like:

var_templates:
    my_plugin:
        path: "{looper.piface_dir}/pipelines/pipeline1.py"  
command_template: >  
  {pipeline.var_templates.my_plugin.path} --sample-name {sample.sample_name} --req-attr {sample.attr} 

@donaldcampbelljr
Copy link
Contributor

donaldcampbelljr commented Jun 18, 2024

I have this working in #502

donaldcampbelljr added a commit that referenced this issue Jun 19, 2024
donaldcampbelljr added a commit that referenced this issue Jun 19, 2024
This reverts commit a1640f2.
donaldcampbelljr added a commit that referenced this issue Jun 19, 2024
@donaldcampbelljr
Copy link
Contributor

I've added recursive functions to expand and render the var_templates so the user can nest them more than 2 levels if they desire.

donaldcampbelljr added a commit that referenced this issue Jun 19, 2024
@donaldcampbelljr donaldcampbelljr modified the milestones: v2.0.0, v1.9.0 Jun 24, 2024
@nsheff nsheff added this to PEP Jun 25, 2024
@github-project-automation github-project-automation bot moved this to Done in PEP Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants