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

Move trace_message from arguments to vw object #1688

Merged

Conversation

jackgerrits
Copy link
Member

This is required for the larger task of replacing the arguments object

@rajan-chari rajan-chari merged commit 887f251 into VowpalWabbit:master Dec 11, 2018
@JohnLangford
Copy link
Member

I may not quite understand the plan.

trace_message was previously in the global datastructure and then was moved to the arguments datastructure when that was created. The core reason for this is that many of the setup() functions need to leave messages and I wanted to shift away from having setup() be dependent on the global data structure. Shifting back, you introduce a spurious dependence on the global datastructure for many reductions. Why?

@rajan-chari
Copy link
Member

In the short term, @jackgerrits wanted to remove all non-args logic out of args implementation. Also probably good from a seperation of concerns perspective.

Longer term, as we remove dependence on 'all', there a number of "dependency injection" approaches we can use.

One approach is here:

https://github.com/VowpalWabbit/reinforcement_learning/blob/d61b87ad619781c9c1037b76486850a717868e8a/rlclientlib/live_model_impl.cc#L128
This allows the library user to specify what kind of logging they want (if any).

A second option is to let a driver pass a trace interface into the setup (factory) function that constructs the reduction

A third option used in some composable systems is a service_provider class that a component can query for the services it needs (trace logging in this case). The same service_provider would also support registering services with the provider. This would allow a driver (or client code) to implment and register trace providers and each reduction could ask for trace provider.

@jackgerrits
Copy link
Member Author

I agree, it brings back a dependence on the global data structure but I think @rajan-chari explained it well. In order to replace the Arguments object I need to move some of the components out of it. I do think that if anything is allowed to exist in the global object then the tracer makes decent sense. Longer term the tracer should be passed separately to initialization or through one of the methods Rajan said.

@JohnLangford
Copy link
Member

JohnLangford commented Dec 12, 2018 via email

@jackgerrits
Copy link
Member Author

Okay that makes sense. As we work towards the larger refactoring changes that we've discussed the changes needed become prohibitively large in terms of complexity and size. As you said though we always want to stay in a state where we are functioning correctly and not left in a bad state. @rajan-chari (chime in if you disagree with me) and I will try and find a happy medium between manageable incremental changes and continuing the evolution of the codebase. I do agree with you though, we shouldn't ever be at a point which we fundamentally disagree with approach checked in.

@rajan-chari
Copy link
Member

I was thinking about this. The intermediate states might be less than ideal. Reviewing smaller transformations is optimal from a workflow perspective. Perhaps pull requests to a refactoring branch? We can merge periodically once we are in a good intermediate state.

@JohnLangford
Copy link
Member

JohnLangford commented Dec 12, 2018 via email

@jackgerrits jackgerrits deleted the jagerrit/move_trace_message branch January 15, 2019 18:15
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.

None yet

3 participants