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

Allow fallbacks for failing entity tasks + fallback functions for 'local_t_star' and 'mu_star_calibration' #663

Merged
merged 5 commits into from Jan 14, 2019

Conversation

Projects
None yet
2 participants
@matthiasdusch
Copy link
Member

commented Jan 10, 2019

  • Tests added/passed
  • Fully documented
  • whats-new entry

This PR expands the execute_entity_task decorator with a fallback argument:
If a task fails and cfg.PARAMS['continue_on_error']==True a fallback-function will be executed If provided).

I suggest storing these fallback functions in utils/_fallbacks.py.

Hera also two first fallback functions for climate.local_t_star and climate.mu_star_calibration are included.
local_t_star writes a local_mustar.json to the glacier directory with information on tstar, mustar, and bias. If this task fails but cfg.PARAMS['continue_on_error']==True later tasks like 'mu_star_calibration' would read a possible preexisting json file (e.g. if the same glacier is run several times with different parameter settings).

matthiasdusch added some commits Jan 9, 2019

@matthiasdusch matthiasdusch requested a review from fmaussion Jan 10, 2019

@fmaussion

This comment has been minimized.

Copy link
Member

commented Jan 11, 2019

Looking good, thanks! I think it should be relatively easy to add a test for this, by setting unrealistic mu_start boundaries and let the run fail, then check that the files are nans. Could you add that?

@matthiasdusch

This comment has been minimized.

Copy link
Member Author

commented Jan 14, 2019

After discussion with @fmaussion I removed utils/_fallbacks.py and added fallback_local_t_star directly to the climate module. It's a specific fallback function and not a general one.

I also got rid of fallback_mu_star_calibration: It is not really necessary as subsequent tasks will fail anyway, not matter if e.g. local_mustar['mu_star_allsame'] is NaN or does not exist et all. The important part is, that fallback_local_t_star writes and NaN-filled file to the GDir to avoid reuse of a previous run.

@matthiasdusch matthiasdusch merged commit d918505 into OGGM:master Jan 14, 2019

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.7%) to 87.571%
Details

@matthiasdusch matthiasdusch deleted the matthiasdusch:fallbacks branch Jan 14, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.