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

Implement #HQ directives #6

Closed
spirali opened this issue Mar 31, 2021 · 2 comments · Fixed by #325
Closed

Implement #HQ directives #6

spirali opened this issue Mar 31, 2021 · 2 comments · Fixed by #325
Milestone

Comments

@spirali
Copy link
Collaborator

spirali commented Mar 31, 2021

Implement equivalent to #PBS directives in shell scripts

@giovannipizzi
Copy link

This would be very useful! Since our software AiiDA expects/requires the directives to be put within the file, and submit simply with hq submit script.sh (as a way to store this information for later debugging, if needed) at the moment we are planning to write a simple wrapper script hq-wrapper-submit script.sh that will parse lines like

#HQ --cpus=32 
#HQ --cwd=run2bis

...

and actually submit hq submit --cpus=32 --cwd=run2bis script.sh.

However, having this directly supported by hq would be great and avoids us maintaining a wrapper, and having to ask users to install also this together with hq.

I think the logic might be simple:

  1. start from the first line in the file, and check line by line
  2. skip all lines that are empty or only contains white spaces after removing comments (signalled by #); this also includes the first shebang line (#!/bin/bash or similar) if present
  3. if the line starts with #HQ , get the rest and pass it as a command line (we would do it "blindly", but since you know the parameters you could already check if they are valid to avoid injection of commands, e.g. if one writes #HQ --cpus=32; rm *, or at least escape each of them with quotes? :-)
  4. as soon as you find a non-empty line, stop processing the #HQ commands (i.e., in a file like this:
    #HQ --cpus=32 
    echo 123
    #HQ --cwd=run2bis
    
    only the first directive would be passed to hq, but the second --cwd would be ignored because there is a non-comment line echo 123 before).

@Kobzol
Copy link
Collaborator

Kobzol commented Dec 13, 2021

Something like this indeed sounds reasonable, we could take inspiration from e.g. Slurm commands.
It's currently a bit lower priority though, as there are a lot of other issues (a lot of them suggested by you :D ) that we want to resolve first.

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.

4 participants