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

Don't automatically rebuild EUROMODpolicySchedule file and check for valid file. #45

Conversation

andrewbaxter439
Copy link
Collaborator

Closes #44 by adding an option to not rebuild Excel file and exit with error if no file found.

@andrewbaxter439 andrewbaxter439 marked this pull request as ready for review December 18, 2023 12:20
@andrewbaxter439
Copy link
Collaborator Author

Hi @pbronka - have tested this out and it should work smoothly to fix my accidentally introduced bug. SimPathsStart accepts a new command-line argument:

usage: SimPathsStart [-c <CC>] [-s <year>] [-Setup] [-r] [-g <true/false>]
       [-h]
SimPathsStart will start the SimPaths run. When using the argument
`Setup`, this will create the population database and exit before starting
the first run. It takes the following options:

...
 -r,--rewrite-policy-schedule   Re-write policy schedule from detected
                                policy files

This will mean that it defaults to false - not overwriting the 'EUROMODpolicySchedule.xlsx' file. But I've added a check to see if the file exists and exit with message if both missing and no-rewrite. The rewrite option (-r) will instead not check for an existing file, will read the contents of 'input/EUROMODoutput' directory and will attempt to automatically match year by filename. The user can thus customise their run by providing either a set of output files with non-overlapping year values in filenames or a pre-set 'EUROMODpolicySchedule.xlsx' file to specify which file/year combinations to use.

This pull request also makes some small additional changes:

  • calculateEUROMODpolicySchedule was reading the policy schedule workbook and detecting "" as a do-not-use-file entry; manually editing xlsx file left a blank which was read in as a null value which it failed to detect. Have added extra test so that leaving a blank cell is correctly interpreted as 'do not use this file for this year'.
  • some GitHub Actions runs were failing at the singlerun.jar stage but not returning an error. multirun.jar then gets stuck in an infinite loop before Actions force-quits after 6 hours. Have added a check for the expected output files of singlerun.jar to stop this and return 'fail' more quickly if presents a problem.
  • added a test for a 'bad country' argument ('XX'). More tests for 'bad year' arguments would be good practice but not implemented here
  • Added new -r argument to 'README.md'

As an aside, I think a potential wiki page could cover "Customising your SimPaths run" to outline best practices for using features to make SimPaths fit user purpose (summarising the above bit clearly and adding in other parts such as customising config file). I'll aim to make a draft at some point.

@pbronka
Copy link
Contributor

pbronka commented Dec 19, 2023

Thank you @andrewbaxter439 . A wiki page sounds like a great idea to me. I'm not sure if you can currently edit it - if not, please let me know and we will figure it out.

@pbronka pbronka merged commit ff15c2f into centreformicrosimulation:develop Dec 19, 2023
2 checks passed
@andrewbaxter439 andrewbaxter439 deleted the bugfix/44_check_policySchedule branch December 19, 2023 09:56
@andrewbaxter439
Copy link
Collaborator Author

As a brief side point - apologies @pbronka if you get a stream of notification emails every time I do a pull request with a GitHub Actions run that fails! I might start test-pull-requests to my own repo first as they can get quite annoying if they keep crashing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants