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

[RLlib] Stats bug fix: EMA stats w/o window would lead to infinite list mem-leak. #45752

Conversation

sven1977
Copy link
Contributor

@sven1977 sven1977 commented Jun 5, 2024

  • Stats bug fix: EMA stats w/o window would lead to infinite list mem-leak, slowing down execution (and learning).
  • Minor cleanups and enhancements, mostly in preparation for upcoming IMPALA on new stack.

Why are these changes needed?

Related issue number

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
    • I've added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

Signed-off-by: sven1977 <svenmika1977@gmail.com>
@sven1977 sven1977 enabled auto-merge (squash) June 5, 2024 12:54
@github-actions github-actions bot added the go add ONLY when ready to merge, run all tests label Jun 5, 2024
@sven1977 sven1977 added the tests-ok The tagger certifies test failures are unrelated and assumes personal liability. label Jun 5, 2024
@@ -310,7 +310,7 @@ def __call__(
)
self.add_n_batch_items(
batch=data,
column="loss_mask",
column=Columns.LOSS_MASK,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Great! More constants! This will reduce our errors everywhere in the lib.

None make them synchronous calls.
timeout_seconds: Time to wait (in seconds) for results. Set this to 0.0 for
fire-and-forget. Set this to None (default) to wait infinitely (i.e. for
synchronous execution).
Copy link
Collaborator

Choose a reason for hiding this comment

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

Great description!


Returns:
A tuple of corresponding (remote_calls, remote_actor_ids, valid_tags)

A tuple consisting of a list of the remote calls that match the tag(s),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Interesting. Did we have this all this time? So we can tag certain tasks and check, if these tasks have been worked?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct. This was always there, albeit rarely used b/c we don't really have any async algos on Learner API, yet.

You can send async requests to the ActorManager with a tag, then - later - fetch the async results from the manager using this tag, kind of as a label to say: I only want these results, the others - even if already ready - I don't care about right now and will fetch them later.

)
remote_calls = []
remote_actor_ids = []
valid_tags = []
for call, (tag, actor_id) in self._in_flight_req_to_actor_id.items():
# the default behavior is to return all ready results.
if not len(tags) or tag in tags:
if len(tags) == 0 or tag in tags:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this mean we throw away all other results not having this tag? What if we have e.g. 2 tags and we call this function and we need afterwards the two tags separately (maybe results are from different sampling regimes) - cann we distinguish by gthe valid_tags the results?

@simonsays1980 simonsays1980 self-requested a review June 6, 2024 10:06
Copy link
Collaborator

@simonsays1980 simonsays1980 left a comment

Choose a reason for hiding this comment

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

LGTM.

@sven1977 sven1977 merged commit cbb1634 into ray-project:master Jun 6, 2024
6 checks passed
@sven1977 sven1977 deleted the fix_metrics_stats_bug_ema_infinite_growth branch June 6, 2024 11:08
ryanaoleary pushed a commit to ryanaoleary/ray that referenced this pull request Jun 6, 2024
…st mem-leak. (ray-project#45752)

Signed-off-by: Ryan O'Leary <ryanaoleary@google.com>
yucai pushed a commit to yucai/ray that referenced this pull request Jun 7, 2024
yucai pushed a commit to yucai/ray that referenced this pull request Jun 7, 2024
richardsliu pushed a commit to richardsliu/ray that referenced this pull request Jun 12, 2024
…st mem-leak. (ray-project#45752)

Signed-off-by: Richard Liu <ricliu@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go add ONLY when ready to merge, run all tests tests-ok The tagger certifies test failures are unrelated and assumes personal liability.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants