incubator-heron icon indicating copy to clipboard operation
incubator-heron copied to clipboard

Need support for dependency injection in custom implementations

Open ashvina opened this issue 9 years ago • 6 comments

Currently all custom implementations are initialize using two config hashmaps. As discussed in #1285, such a pattern is vulnerable to frequent interface changes. Any errors due to incorrect types or missing configs surface at runtime only. It would be better to have a mechanism which simplifies exchanging global objects and fails fast (at compile time). For e.g. Tang framework in Apache REEF, https://reef.apache.org/tang.html.

ashvina avatar Aug 23 '16 22:08 ashvina

We use Guice extensively at Twitter too: https://github.com/google/guice/wiki/Motivation

billonahill avatar Aug 23 '16 22:08 billonahill

@ashvina and @billonahill - who wants to pick this up.

kramasamy avatar Aug 30 '16 07:08 kramasamy

I'd be up for taking this on after the scaling work.

billonahill avatar Aug 30 '16 15:08 billonahill

I too can free up some cycles for this improvement. May be this can be done incrementally, one interface at a time.

BTW, I spoke to a couple of folks here about Guice. Dagger and Tang seem to have evolved from Guice. Both systems provide static compile time checks which seem to be a major limitation of Guice. So I think we could use the newer solutions. I used tang in the YARN scheduler. Most of the configuration errors will be flagged by the IDE itself. It reduced number of required iterations. If you think it helps, I can create a small patch as an example. Although the Tang community is very active, there is limited support available outside.

Misc references on Dagger

  1. https://dig.floatingsun.net/dagger-vs-guice-8c9fbae4712e#.e1223p2x7
  2. https://blog.gouline.net/dagger-2-even-sharper-less-square-b52101863542#.pkksdqat1

ashvina avatar Aug 30 '16 16:08 ashvina

@ashvina and @billonahill - if you could collaborate and come with a plan, it will be great!

kramasamy avatar Aug 30 '16 16:08 kramasamy

Tang is in the codebase around schedulers, is the covered now?

Code0x58 avatar Jul 15 '20 17:07 Code0x58