-
Notifications
You must be signed in to change notification settings - Fork 121
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
feat: add PyHPS CLI #3091
base: main
Are you sure you want to change the base?
feat: add PyHPS CLI #3091
Conversation
It works
Thanks for opening a Pull Request. If you want to perform a review write a comment saying: @ansys-reviewer-bot review |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3091 +/- ##
==========================================
- Coverage 87.12% 80.68% -6.44%
==========================================
Files 55 60 +5
Lines 9768 10556 +788
==========================================
+ Hits 8510 8517 +7
- Misses 1258 2039 +781 |
src/ansys/mapdl/core/cli/hpc.py
Outdated
) | ||
|
||
if config_file is None: | ||
config_file = os.path.join(os.getcwd(), "hps_config.json") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@germa89 should the config be in appdirs
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MMhhh... if we use a file in the root directory, we could point to different files.... and hence multiple configurations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But maybe you are right... maybe it is better to use appdirs
.... buttt... it might be a bit hidden for the user...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And we have many options to be keep in the file:
{
"url": "https://10.231.106.91:3000/hps",
"user": "repuser",
"password": "repuser",
"python": "3.9",
"name": "my job",
"num_cores": 1,
"memory": 100,
"disk_space": 100,
"exclusive": false,
"max_execution_time": 1000
}
keeping so many important options hidden in a appdir
path might bring some complications.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@germa89 use keyring for user/password. I don't think its secure enough to put that in plaintext like this. For everything else I would agree
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree.
src/ansys/mapdl/core/hpc/pyhps.py
Outdated
requirements_file = create_tmp_file("requirements.txt", content) | ||
logger.debug(f"Requirements file in: {requirements_file}") | ||
|
||
if not shell_file: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shell file is needed because pyhps doesn't support python jobs with a venv. I think we should see if that feature can be added to pyhps itself. Maybe using pip-run
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree we need to support venv within pyhps. Using pip-run
seems interesting. For flexibility I would keep an optional shell file though.
src/ansys/mapdl/core/cli/hpc.py
Outdated
requirements_file: str = None, | ||
extra_files: Optional[Union[str, list]] = None, | ||
config_file: str = None, | ||
num_cores: int = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
option to download the result files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not aware if we can do that from the PyHPS library... i will check it out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, It can be done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Making ``wait`` ``true`` if `output_to_json`
Update 18-Jun-2024NotesThis approach needs carefull plannification which should be done in the following days. FeaturesThere are some feature requests which I'm going to write here, instead of an issue. To be implemented before end of sprint
Postponed until current approach is supported officially.
|
* First approach to login * Adding HPS dependencies * Adding changelog entry: 3205.miscellaneous.md * feat: Coupling login code to current implementation. Allowing login using token which is now the preferred method. * coupling cli * fix: command name in CLI * Adding changelog entry: 3205.added.md * fix: wrong argument that avoid having the input file as argument * chore: checking config file in submit function. * feat: avoid venv creation of ``requirements_file`` is False. * feat: login CLI finished * feat: making sure we don't get import errors when PyHPS is not installed. * feat: Adding docstrings * chore: renaming 'access' to 'get_token_access'. * fix: failing piping on the CLI. --------- Co-authored-by: pyansys-ci-bot <[email protected]>
As the title.
The idea is you can have:
$ pymapdl submit main_file.py $ pymapdl submit --name="my project" main_file.py --requirements_file=requirements.txt
The help shows: