ansys / pyhps

A Python client for Ansys HPC Platform Services (HPS)
https://hps.docs.pyansys.com/
MIT License
0 stars 0 forks source link

enable queries over the set of files supported by project API method copy_default_execution_script #393

Open ansAFinney opened 5 months ago

ansAFinney commented 5 months ago

📝 Description of the feature

problem

it is not possible to determine the set of arguments that copy_default_execution_script supports for example you can't create a drop down list in a UI through which a user could select a script

suggested solution

add project api method get_default_execution_scripts(**query_parameters) where query parameters can be version and product and other fields that are relevant in the script naming scheme.

the result is a list of script names that can be passed to copy_default_execution_script (the get_default_execution_scripts method shouldn't copy the files)

💡 Steps for implementing the feature

No response

🔗 Useful links and references

No response

FedericoNegri commented 5 months ago

@ansAFinney I've started this https://github.com/ansys/pyhps/pull/399/files#diff-a79a7ec7df27242fbfbc1e3c0be88b34e17f1939289af2462f5987935867f35b to expose a JmsApi.list_default_execution_scripts method purely based on the file storage content. However, in your case I think you would be better off querying the templates and getting the script name from there:

from ansys.hps.client import Client, JmsApi

cl = Client(url="https://localhost:8443/hps", username="repuser", password="repuser")
jms_api = JmsApi(cl)

qwargs = {"name.contains": "Ansys LS-DYNA"}

print([t.execution_script_storage_id for t in jms_api.get_task_definition_templates(**qwargs)])

## output: ['lsdyna-v232-exec_lsdyna.py', 'lsdyna-v241-exec_lsdyna.py']