OSC / ood_core

Open OnDemand core library
https://osc.github.io/ood_core/
MIT License
10 stars 28 forks source link

don't raise error on cluster config not found #757

Open johrstrom opened 2 years ago

johrstrom commented 2 years ago

I'm not really sure why we raise an error here - but we really shouldn't. Instead it should just be graceful degradation instead of a fatal error. Maybe we warn to stderr that it's empty, but raising an error here seems a bit strong. So you didn't find a configuration? Let the upper layer deal with the fact that there are no clusters.

https://github.com/OSC/ood_core/blob/07aff911eb8aaf9d691c48b1b10df1cbaf21346a/lib/ood_core/clusters.rb#L52

This is the error I get running rake tasks.

== Preparing database ==
rails aborted!
OodCore::ConfigurationNotFound: configuration file '/etc/ood/config/clusters.d' does not exist
/users/PZS0714/johrstrom/ondemand/dev/osc-reporting/vendor/bundle/ruby/2.7.0/gems/ood_core-0.19.0/lib/ood_core/clusters.rb:52:in `load_file'
/users/PZS0714/johrstrom/ondemand/dev/osc-reporting/app/models/active_jobs.rb:25:in `block in clusters'
/users/PZS0714/johrstrom/ondemand/dev/osc-reporting/vendor/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/cache.rb:804:in `block in save_block_result_to_cache'
/users/PZS0714/johrstrom/ondemand/dev/osc-reporting/vendor/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/cache.rb:778:in `block in instrument'
/users/PZS0714/johrstrom/ondemand/dev/osc-reporting/vendor/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/notifications.rb:208:in `instrument'
/users/PZS0714/johrstrom/ondemand/dev/osc-reporting/vendor/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/cache.rb:778:in `instrument'
/users/PZS0714/johrstrom/ondemand/dev/osc-reporting/vendor/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/cache.rb:803:in `save_block_result_to_cache'
/users/PZS0714/johrstrom/ondemand/dev/osc-reporting/vendor/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/cache.rb:369:in `fetch'
/users/PZS0714/johrstrom/ondemand/dev/osc-reporting/app/models/active_jobs.rb:23:in `clusters'

┆Issue is synchronized with this Asana task by Unito