这是indexloc提供的服务,不要输入任何密码
Skip to content

Remove data from state in Collector, and remove preprocess_fn there #1058

@MischaPanch

Description

@MischaPanch

The Collector tracks the self.data field that is a RolloutBatch. However, rather confusingly, this value of this field is recreated and updated at every call to collect. This leads to a lot of methods mutating the state, and a less comprehensible and debuggable code.

There is no need to bind this to the lifetime of the Collector, instead it should be created and used as a var in collect.

Moreover, there is the possibility to pass preprocess_fn, which

  1. doesn't have a clear interfaces
  2. doesn't have a clear purpose
  3. Is only used in a test and nowhere else
    It seems like the original purpose of that was to enable specific logging needs, but these needs can be met by different means.
  4. Significally complicates the Collector

The preprocess_fn in Collector should be removed

This issue blocks #1046 since we need to reduce the complexity of the Collector before doing anything further with it

@bordeauxred is working on this issue

Metadata

Metadata

Labels

refactoringNo change to functionality

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions