Skip to content

[Pubsub] refactor pubsub to support different channel types - #19498

Merged
rkooo567 merged 6 commits into
ray-project:masterfrom
mwtian:pubsub
Oct 20, 2021
Merged

rkooo567 merged 6 commits into
ray-project:masterfrom
mwtian:pubsub

Conversation

@mwtian

@mwtian mwtian commented Oct 19, 2021 •

Copy link
Copy Markdown
Member

Why are these changes needed?

  • Pull in pubsub changes from Replace Actor Channel's pubsub with grpc #16723 to support publishing messages for ActorID in addition to ObjectID. The main change is to allow Publisher::subscription_index_map_ to hold SubscriptionIndex keyed on ActorID in addition to ObjectID.
  • Apply more refactoring to allow publishing and subscribing to a subset of channels. This is because core worker, GCS and other subscribers would use different sets of channels. Specifying the channel subset would allow some sanity checks.
  • There should be no functionality difference.

Related issue number

Checks

@mwtian
mwtian marked this pull request as ready for review October 19, 2021 02:26
Comment thread src/ray/pubsub/publisher.h Outdated
/// Index that stores the mapping of messages <-> subscribers.
absl::flat_hash_map<rpc::ChannelType, pub_internal::SubscriptionIndex<ObjectID>>
absl::flat_hash_map<rpc::ChannelType,
std::unique_ptr<pub_internal::SubscriptionIndexInterface>>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Question here, why do we need a base class for this? If it's about the different type of the key, should we use template instead?

@mwtian mwtian Oct 19, 2021 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Basically, the approach here is to allow subscription_index_map_ which is absl::flat_hash_map to hold all SubscriptionIndex, no matter the SubscriptionIndex key type. So we have to use an interface to "type erase" the template types. Publisher has member functions that are agnostic to the channel type, e.g. UnregisterSubscriber(). So I don't see a better / simpler approach yet.

It seems possible to turn Publish() and a few other member functions to be templated on channel type, making some sanity checks static. We can come back later for that.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Chatted with Yi off thread. Converted SubscriptionIndex to be keyed by std::string instead of a templated key type.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this is fine, but would there be any risk some different ID types are conflicting? I assume the probablity is pretty low?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think there shouldn't be any higher chance of collision, because no hash map is merged? Only the value type of subscription_index_map_ is changed from templated SubscriptionIndex to SubscriptionIndex with std::string key ID. Within each SubscriptionIndex there shouldn't be higher chance of collision either, since the set of IDs are still the same.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ah, I see. So there's one index per channel (I forgot about this although I wrote it lol...)

@mwtian

mwtian commented Oct 19, 2021

Copy link
Copy Markdown
Member Author

cc @ericl

@fishbone fishbone left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LG. Thanks for some improvement in the code quality.

@rkooo567 rkooo567 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. Just one comment.

@rkooo567
rkooo567 merged commit aaff690 into ray-project:master Oct 20, 2021
elliot-barn added a commit that referenced this pull request Sep 3, 2026
… outage (#65880)

## Why this change is needed

`data.pyg.org`, the PyG wheel index that every ML/data/rllib depset
declares via `--find-links`, has been a dangling CNAME since 2026-09-02:
it points at `d28mro9bmx3ky3.cloudfront.net`, and that CloudFront
distribution returns `NOERROR` with zero answers from 8.8.8.8, 1.1.1.1
and 9.9.9.9. Upstream is tracking it at pyg-team/pyg-lib#719 and has
said they are working on it with urgency; as of their last update there
is no ETA.

uv fails eagerly on an unreadable `--find-links` URL before deciding
whether it needs anything from it, so `raydepsets build --all-configs
--check` is red on every run regardless of the PR's contents:

| Pipeline | Build | Time (UTC) | Result |
|---|---|---|---|
| postmerge | #19487 | Sep 2 05:05 | passed (last good) |
| postmerge | #19498 | Sep 2 15:28 | pyg DNS |
| postmerge | #19501 | Sep 2 16:09 | pyg DNS |
| postmerge | #19507 | Sep 2 20:06 | pyg DNS |
| postmerge | #19511 | Sep 3 00:05 | pyg DNS |
| premerge | #72711, #72712 | Sep 2 | pyg DNS |

Every run since ~15:30Z Sep 2 has failed. It blocks every
`python_dependencies`-tagged PR and paints master red.

The `pip-compile dependencies` step is **not** affected and is left
alone: pip treats an unreachable find-links as a warning, PyPI's sdist
satisfies `torch-scatter==2.1.2`, and since `requirements_compiled.txt`
pins without the `+pt29cpu` local version the output is byte-identical.
It passed in all six of the builds above where raydepsets failed, so it
keeps guarding `requirements_compiled.txt`.

## What changes

`soft_fail: true` on the `raydepsets: compile all dependencies` step,
with a comment recording why and when to remove it.

`soft_fail` rather than removing the step: the job still runs and
reports, so it turns green on its own when upstream restores the record,
and reviewers can still see lock drift in its output in the meantime.
There's precedent for this pattern in `lint.rayci.yml`
(`api-param-coverage`).

## What this does not fix

- **Image builds.** 32 deplocks carry the find-links line, so any wanda
image build that misses cache fails at `pip install` inside the
Dockerfile (#72719 lost `docgpubuild-py3.10` and `mlgpubuild-py3.10`
this way). Most PRs are unaffected because unchanged inputs reuse the
cached image. Nothing CI-side fixes this without hosting the wheels
somewhere else, which is a separate change.
- **Lock regeneration.** A PR that needs a new deplock still can't
produce one until the index is back, since the recompile itself reads
the find-links.

## Cost

While this is in, a PR that edits a requirements file without
regenerating its lock can merge. The pip-compile guard still covers
`requirements_compiled.txt`, and the window should be short.

## Revert when

`raydepsets: compile all dependencies` is green on a master postmerge
build. Track pyg-team/pyg-lib#719.

Signed-off-by: elliot-barn <[email protected]>
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
… outage (ray-project#65880)

## Why this change is needed

`data.pyg.org`, the PyG wheel index that every ML/data/rllib depset
declares via `--find-links`, has been a dangling CNAME since 2026-09-02:
it points at `d28mro9bmx3ky3.cloudfront.net`, and that CloudFront
distribution returns `NOERROR` with zero answers from 8.8.8.8, 1.1.1.1
and 9.9.9.9. Upstream is tracking it at pyg-team/pyg-lib#719 and has
said they are working on it with urgency; as of their last update there
is no ETA.

uv fails eagerly on an unreadable `--find-links` URL before deciding
whether it needs anything from it, so `raydepsets build --all-configs
--check` is red on every run regardless of the PR's contents:

| Pipeline | Build | Time (UTC) | Result |
|---|---|---|---|
| postmerge | ray-project#19487 | Sep 2 05:05 | passed (last good) |
| postmerge | ray-project#19498 | Sep 2 15:28 | pyg DNS |
| postmerge | ray-project#19501 | Sep 2 16:09 | pyg DNS |
| postmerge | ray-project#19507 | Sep 2 20:06 | pyg DNS |
| postmerge | ray-project#19511 | Sep 3 00:05 | pyg DNS |
| premerge | #72711, #72712 | Sep 2 | pyg DNS |

Every run since ~15:30Z Sep 2 has failed. It blocks every
`python_dependencies`-tagged PR and paints master red.

The `pip-compile dependencies` step is **not** affected and is left
alone: pip treats an unreachable find-links as a warning, PyPI's sdist
satisfies `torch-scatter==2.1.2`, and since `requirements_compiled.txt`
pins without the `+pt29cpu` local version the output is byte-identical.
It passed in all six of the builds above where raydepsets failed, so it
keeps guarding `requirements_compiled.txt`.

## What changes

`soft_fail: true` on the `raydepsets: compile all dependencies` step,
with a comment recording why and when to remove it.

`soft_fail` rather than removing the step: the job still runs and
reports, so it turns green on its own when upstream restores the record,
and reviewers can still see lock drift in its output in the meantime.
There's precedent for this pattern in `lint.rayci.yml`
(`api-param-coverage`).

## What this does not fix

- **Image builds.** 32 deplocks carry the find-links line, so any wanda
image build that misses cache fails at `pip install` inside the
Dockerfile (#72719 lost `docgpubuild-py3.10` and `mlgpubuild-py3.10`
this way). Most PRs are unaffected because unchanged inputs reuse the
cached image. Nothing CI-side fixes this without hosting the wheels
somewhere else, which is a separate change.
- **Lock regeneration.** A PR that needs a new deplock still can't
produce one until the index is back, since the recompile itself reads
the find-links.

## Cost

While this is in, a PR that edits a requirements file without
regenerating its lock can merge. The pip-compile guard still covers
`requirements_compiled.txt`, and the window should be short.

## Revert when

`raydepsets: compile all dependencies` is green on a master postmerge
build. Track pyg-team/pyg-lib#719.

Signed-off-by: elliot-barn <[email protected]>
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.

4 participants