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

Create a TPV tutorial on the GTN #74

Closed
nuwang opened this issue Jan 12, 2023 · 11 comments · Fixed by #126
Closed

Create a TPV tutorial on the GTN #74

nuwang opened this issue Jan 12, 2023 · 11 comments · Fixed by #126

Comments

@nuwang
Copy link
Member

nuwang commented Jan 12, 2023

Ping @hexylena
Do you have any suggestions on what it should include, that is missing, or could enhance: https://total-perspective-vortex.readthedocs.io/en/latest/topics/tpv_by_example.html?

@hexylena
Copy link
Member

Just first off, I love the by-example, that's a great bit of reference documentation for someone upgrading an existing configuration, really great as reference.

For the GTN side I think it would be more than sufficient to just upgrade the GAT tutorials to use TPV, rather than showing the DTD or custom python rules, just go 100% all in on TPV.

And since job destinations would essentially be an "overhaul" and replacing the existing tutorial, I think the important things to cover for administrators would be:

  • setting up + using the TPV shared database
  • resubmission with increased memory/cpu (but maybe this is less important with TPVSDB)
  • passing results of resource selectors into a rule
  • very basic access control (e.g. admin only tools)

@nuwang
Copy link
Member Author

nuwang commented Jan 12, 2023

Thanks for the suggestions, I think that's a great approach. Can you clarify passing results of resource selectors into a rule?

@hexylena
Copy link
Member

https://training.galaxyproject.org/training-material/topics/admin/tutorials/job-destinations/tutorial.html#job-resource-selectors this feature. it's most visible on Main to select which cluster a job goes to

@quacksawbones
Copy link

As someone who had trying to get TPV doing what I want in our Galaxy instance, there are a number of things I would really love to see in the TPV documentation/tutorial:

  • A list of "valid" (or invalid) YML entry types (or at least how to work it out e.g. - elif: and -else: (as mentioned in Gitter)
  • Details about which TPV YML entries can execute which types of Python code (whether that's evaluating a single line or a multi-line chunk, as well as including importing modules)
  • How to send the value of entries within a TPV YML file out to the Galaxy logs (for debugging/troubleshooting purposes)
  • How to get TPV accessing custom functions within $GALAXYROOT/lib/galaxy/jobs/rules (if that's possible)

While I acknowledge that @hexylena was who the question was directed to (and that you cannot cover EVERYTHING in a tutorial), the above are among the things I have really struggled with while trying to implement TPV in our Galaxy instance.

@nuwang
Copy link
Member Author

nuwang commented Jan 13, 2023

Thanks @quacksawbones. The hardest part about writing these docs is to figure out where to make info available so all you need is a quick scan, as it's all too easy to bury the information somewhere. These suggestions are super helpful. Regarding the individual suggestions:

  • A list of "valid" (or invalid) YML entry types (or at least how to work it out e.g. - elif: and -else: (as mentioned in Gitter)

Good idea, should have been done sooner!

  • Details about which TPV YML entries can execute which types of Python code (whether that's evaluating a single line or a multi-line chunk, as well as including importing modules)

I think we could combine this with the above idea, and for each entry, include a column on how it will be evaluated (f-string or eval as code block). The rule of thumb is, all strings entries are evaluated as f-strings (e.g. envs, params) and everything else as code blocks. This is in the docs, but buried somewhere.

  • How to send the value of entries within a TPV YML file out to the Galaxy logs (for debugging/troubleshooting purposes)
  • How to get TPV accessing custom functions within $GALAXYROOT/lib/galaxy/jobs/rules (if that's possible)

These two we can add to an FAQ?

@quacksawbones
Copy link

I completely understand @nuwang. As @hexylena mentioned, having the "By Example" sections was really useful to me while getting this working. A couple of additional clarifications:

  • Multiline Python code vs F-strings
    • That's really good to know, but a table I think would help clarify it
    • Some examples of code/evaluation that won't work (with an explanation) would also help. A specific example I had recently:
rules:
- if: |
      import math
      file_size = math.ceiling(jobs.<object methods>.get_file_size() *1.1)
      if file_size > <x>:
        return True

  <code when True>

In the above, the parser tries to execute the if file_size > <x>: as a YML entry, not as part of the code block. Having a few examples of known limitations would help steer people right.

  • Output to Galaxy logs/executing custom functions in $GALAXYROOT/lib/galaxy/jobs/rules:
    • Adding these into the "By Example" section would be really helpful! Maybe custom functions as a subsection of "Rules" and outputting to the Galaxy log to either "Rules" (to confirm your rules are executing as intended) or "Simple Configuration" (as logging is kind of fundamental)?

Thanks again for considering my suggestions! :)

@nuwang
Copy link
Member Author

nuwang commented Jan 13, 2023

Some examples of code/evaluation that won't work

Makes sense. We could add a gotchas/things that won't work page.

Regarding the specific example, the last line of every TPV code block must evaluate to a value. This is true whether it's an if condition (should eval to a boolean value) or cores/mem (should eval to float values), so that there is some final value that can be assigned to the field. This too is in the docs, but it's not obvious unless you're looking for it. A "things that won't work" section should help clarify those.

And yes, we can add the latter two to TPV by example too.

@hexylena
Copy link
Member

We should also consider adding https://github.com/usegalaxy-eu/ansible-tpv-lint to the training playbook to help with this validation (or just running tpv lint locally)

@hexylena
Copy link
Member

hexylena commented Mar 9, 2023

Following up on this, what's the likelihood something could be ready by April 7th or so? @nuwang

@nuwang
Copy link
Member Author

nuwang commented Mar 10, 2023

I think it's doable. Will work on it.

@nuwang nuwang mentioned this issue Feb 5, 2024
@nuwang
Copy link
Member Author

nuwang commented Feb 5, 2024

Between the tutorial here: https://training.galaxyproject.org/training-material/topics/admin/tutorials/job-destinations/tutorial.html#job-resource-selectors and the PR here: #126, we should be able to close this issue.

@nuwang nuwang closed this as completed Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants