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

Allows optional config for reader and ingeseter #102

Merged
merged 1 commit into from
Nov 26, 2018

Conversation

afred
Copy link
Member

@afred afred commented Nov 20, 2018

Adds 'reader_options' and 'ingester_options' as optional config options. These
values are then accessible on IngestTypeConfig object via #reader_options and
#ingester_options accessors.

TODO: The BatchRunner (and whichever other objects are responsible for
intantiating Reader and Ingester objects) need to pass these options along to
construtors for those classes.

Copy link
Member

@cjcolvar cjcolvar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks pretty good. I'm curious what the use case for a single, non-keyed config string might be. I'm not quite sure how to pass that to the reader/ingester without it being confusing with opts sometimes being a hash and sometimes something else. I'd really prefer to be consistent and only allowing hashes.

@afred
Copy link
Member Author

afred commented Nov 20, 2018

@cjcolvar you can always do something like this...

# in BatchRunner#read, current code does this...
# reader = config.reader.new(batch.source_location)
# instead, change it to this...
reader_params = [batch.source_location, config.reader_options]
reader = config.reader.new(*reader_params)

I don't have strong opinions though.

@afred
Copy link
Member Author

afred commented Nov 20, 2018

As for use case, I was thinking more of flags, e.g.

class MyCustomIngester
  def initialize(run_derivatives=false)
    @run_derivatives = ['true', "TRUE", "1", true, 1].include? run_derivatives
  end
end

@cjcolvar
Copy link
Member

cjcolvar commented Nov 20, 2018

I think I'd really like to keep everything as hashes for consistency, for keys, and for easier support for ENV variables (for docker/cloud deployment).

@afred
Copy link
Member Author

afred commented Nov 20, 2018

Right on. Stand by for update.

Adds 'reader_options' and 'ingester_options' as optional config options. These
values are then accessible on IngestTypeConfig object via `#reader_options` and
`#ingester_options` accessors.

TODO: The BatchRunner (and whichever other objects are responsible for
intantiating Reader and Ingester objects) need to pass these options along to
construtors for those classes.
@afred afred force-pushed the allow_optional_config_for_reader_and_ingester branch from 50dfb14 to 447b0e6 Compare November 21, 2018 05:00
@afred
Copy link
Member Author

afred commented Nov 21, 2018

@cjcolvar the change doesn't really change anything, other than the dummy value passed in for the optional ingester_options value.

I started to do some validation on the the reader_options and ingester_options config values and realized the whole thing would be a lot cleaner if we use ActiveModel::Validatons instead of the existing ad-hoc validation going on, so I created #104 for doing that.

Copy link
Member

@cjcolvar cjcolvar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@cjcolvar cjcolvar merged commit 7b87ee4 into master Nov 26, 2018
@cjcolvar cjcolvar removed the review label Nov 26, 2018
@cjcolvar cjcolvar deleted the allow_optional_config_for_reader_and_ingester branch November 26, 2018 14:36
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