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

Defining file name in .yaml file for module option using your proper resource folder #327

Open
areysset opened this issue May 4, 2021 · 1 comment
Assignees
Labels
documentation Documentation needs change or addition enhancement New feature or request

Comments

@areysset
Copy link

areysset commented May 4, 2021

I'm currently using my proper folder for the aerodynamics airfoils profile file (in aerodynamics).
The .toml (and now .yaml) was giving as an option the file name my_naca.af and aerodynamics was previously (v0.5.4b version of FAST-OAD) looking for the file in my dedicated path using copy_ressource function (see openvsp.txt).

The problem is now FASTOADProblemConfigurator._parse_problem_table() includes auto-completion for passed option whose name finish by file (ex: wing_airfoil_file):
name.endswith("file") = True
Which lead to have as an option my_oad_test_function_path\my_naca.af:
options[name] = pth.join(conf_dirname, option_value)

And that leads to an error for me since the file is obviously not located here.
I think it should be mentioned for users at least (or corrected if it was not the way pretending to be used). My way around will be to rename the options in my dedicated function to avoid that issue (because I want beginner users to use airfoil names that can be listed and not specify complete path).

oad_process_be76.txt
openvsp.txt

@christophe-david christophe-david added the documentation Documentation needs change or addition label May 5, 2021
@christophe-david christophe-david changed the title [Not Issue but comment] Defining file name in .yaml file for module option using your proper ressource folder! Defining file name in .yaml file for module option using your proper resource folder May 5, 2021
@christophe-david christophe-david added the enhancement New feature or request label May 5, 2021
@christophe-david
Copy link
Contributor

Agreed, this part should be better documented.

We have to use this trick for many other options to work: it is often natural to allow that the configuration file contains relative path for some file-related options, and we cannot handle that at module level, where the path of the configuration file is not available.

As you have seen, modifying the option name is a solution. But if you expect your user to be able to provide its own file also, then he will have to provide an absolute path, because you avoid the mechanism that resolves relative paths from the folder of configuration file.

A second solution is what we use in the performance module, where we need to provide the possibility to choose a mission file that can be bundled, or custom. When choosing a bundled file, user has to provide the name, preceded by ::.
Currently, this trick is managed in the mission module, that trims whatever is found before ::, but we should probably provide this mechanism in a general way.

@christophe-david christophe-david self-assigned this Jun 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Documentation needs change or addition enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants