-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consolidate parsing into common_functions (#211)
This commit re-factors the adding of parsed arguments into a set of functions that add related arguments. Each script can then simply use some of these function as parent parsers when setting up the ArgumentParser for that script. Note: there are still some issues with how arguments are passed through from run_end_to_end to the other scripts. For instance, the scenario name is required for run_scenario.py but in theory not for run_end_to_end.py. However, run_end_to_end.py calls run_scenario.py, so you will get an error message if you don't provide it in run_end_to_end.py and the error message will be a somewhat confusing combination of run_end_to_end.py and run_scenario.py One solution could be to get rid of scenario_id and make scenario a required argument. The value can be either the ID or the name, and we can add some functionality to smartly determine what is provided and get the equivalent name/id from the db (if needed). Possible future updates: - remove reverting to a hard-coded default scenario_location in gridpath.common_functions.determine_scenario_directory() and simply use the default value from the argument parser. We might want to get rid of the function entirely and simply call os.path.join(scenario_location, scenario) whenever needed. - similarly for the database, I think it might be more clear to add the default db_path to the argument parser definition, rather than assigning it in db.common_functions.connect_to_database.
- Loading branch information
Showing
7 changed files
with
181 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.