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

Initializer inputs #894

Merged
merged 8 commits into from
Jan 13, 2017
Merged

Initializer inputs #894

merged 8 commits into from
Jan 13, 2017

Conversation

grdw
Copy link
Contributor

@grdw grdw commented Jan 9, 2017

This is the most basic implementation of the initializer inputs.

Related to: quintel/atlas#81

@grdw grdw force-pushed the local-datasets-initializer-inputs branch 3 times, most recently from 2ee6cbc to 8a2fc9e Compare January 10, 2017 08:45
@grdw grdw changed the title Adding WIP implentation of initializer inputs Initializer inputs Jan 10, 2017
@grdw grdw force-pushed the local-datasets-initializer-inputs branch 2 times, most recently from 5013ee3 to 7069430 Compare January 10, 2017 13:34
@grdw grdw requested a review from ploh January 11, 2017 10:10
@grdw grdw force-pushed the local-datasets-initializer-inputs branch from 7069430 to 5c49a94 Compare January 11, 2017 14:05
@ploh ploh requested review from ploh and removed request for ploh January 12, 2017 13:13
@ploh
Copy link
Contributor

ploh commented Jan 12, 2017

@grdw I pushed my suggestions for this. Please review, further adapt if necessary and merge. Thx.


def apply_initializer_inputs(graph = nil)
unless graph
Copy link
Contributor Author

@grdw grdw Jan 12, 2017

Choose a reason for hiding this comment

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

This is a bit of a weird solution to be honest, why cramp everyting in a single method?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, it seemed like a cool idea earlier, but now at second glance it looks weird!

init.
map { |key, val| [Input.fetch(key), val] }.
sort_by { |input, _| input.priority }.
reverse
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm a bit of a fan of splitting these things up in several methods like:

def initializer_inputs
  decorated_inputs.sort_by { |input, _| input.priority }.reverse
end

private

def decorated_inputs
  (area.init || {}).map do |key, val|
    [Input.fetch(key), val]
  end
end

... or something like that.

@grdw grdw force-pushed the local-datasets-initializer-inputs branch from d9c7d97 to 02ee402 Compare January 13, 2017 08:54
@grdw grdw merged commit b723698 into local-datasets Jan 13, 2017
@grdw grdw deleted the local-datasets-initializer-inputs branch January 13, 2017 09:04
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