DARMA-tasking / LB-analysis-framework

Analysis framework for exploring, testing, and comparing load balancing strategies
Other
4 stars 1 forks source link

#469: Improve and enrich visualization parameters #470

Closed cwschilly closed 1 year ago

cwschilly commented 1 year ago

Fixes #469

cwschilly commented 1 year ago

I created a script in scripts/update-viz-config.py. It works by either passing a directory of files (-d) or an individual config file (-f) on the command line:

python scripts/update-viz-config.py -d <directory-of-config-files> -o <output-dir-for-new-config-files>

or

python scripts/update-viz-config.py -f <path-to-config-file> -o <output-dir-for-new-file>

You can use either -d or -f, but the -o (output) argument is required.

If you want to overwrite existing configuration files, give their current directory as the -o argument.

I used ruamel.yaml in order to preserve formatting of original config files. To install, just run

pip install ruamel.yaml

The updated config files are passed through the configuration validator automatically. If you know a config file should fail (e.g. some files in tests/unit/config), comment out line 146 (self.__validate_configuration(new_config))

cwschilly commented 1 year ago

Updating the config files in tests/unit/config will be more complicated since some are designed to fail the validator.

@ppebay @nlslatt Is this a good start?

nlslatt commented 1 year ago

@cwschilly It would be nice to maintain the current order of items in the yaml files to the extent that makes sense. Otherwise, a huge diff will be generated for them even though functionally not much changes.

cwschilly commented 1 year ago

@nlslatt @ppebay This should be good to go now. There are minor formatting changes (True to true, indentation, etc.), but using ruamel.yaml preserved ordering, comments, and spacing of the original files.

Is the intention for the updater script to be included within the repo? If so, I've put it in the config directory, but users will need to install ruamel.yaml before running it.

pip install ruamel.yaml

Alternatively, I could include it as a dependency of LBAF (e.g. in requirements.txt).

ppebay commented 1 year ago

@cwschilly you should be able to merge this one

nlslatt commented 1 year ago

@cwschilly Looks like the script to update was moved to scripts/update-viz-config.py after you posted your instructions. I tried running that and had to install ruamel.yaml. Now I get an error because lbaf is not installed on my system. Do I really have to install it or is there another way?

cwschilly commented 1 year ago

I will look into this @nlslatt

cwschilly commented 1 year ago

@nlslatt It should work now without having to install the lbaf package. Let me know if there are any other problems

nlslatt commented 1 year ago

@cwschilly Thanks, that works for me now (although is surprisingly slow, more than 4 seconds for the 49-line yaml file I tested it on).

cwschilly commented 1 year ago

@nlslatt I ran it with the scalene profiler and it seems like most time is spent running the ConfigurationValidator. This is just an added fail-safe, so if you need to speed things up, commenting out line 146 (self.__validate_configuration(new_config)) may help.