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

[For 1.2] Allow both protobuf 3 and 4 in dagster #12466

Merged
merged 1 commit into from
Mar 6, 2023
Merged

[For 1.2] Allow both protobuf 3 and 4 in dagster #12466

merged 1 commit into from
Mar 6, 2023

Conversation

gibsondan
Copy link
Member

@gibsondan gibsondan commented Feb 22, 2023

Summary:
This removes the protobuf3 pin in dagster and re-generates our protobuf api with protobuf 4 (which is mostly backwards compatible with protobuf3, see below)

Two downsides of this:

  • we need to bump our min grpcio version to 1.44 since that's the first version that is protobuf3 and protobuf4 compatible, and our min version of protobuf a bit higher. This leaves our grpcio pin fairly narrow until we can get the upper bound removed once they fix the upstream issues.
  • it nukes our pyright typehints for the generated modules

But users have been clamoring for us to remove this protobuf pin so I think it's worth it

@vercel
Copy link

vercel bot commented Feb 22, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Comments Updated
dagit-storybook ⬜️ Ignored (Inspect) Mar 6, 2023 at 0:16AM (UTC)
dagster ⬜️ Ignored (Inspect) Mar 6, 2023 at 0:16AM (UTC)

@gibsondan gibsondan force-pushed the proto4 branch 10 times, most recently from 3b393f9 to 1f60d2d Compare February 22, 2023 17:18
@gibsondan gibsondan changed the title test removing protobuf pin Allow both protobuf 3 and 4 in dagster Feb 22, 2023
@gibsondan gibsondan force-pushed the proto4 branch 4 times, most recently from b087711 to d1e8e6e Compare February 24, 2023 03:02
@gibsondan gibsondan changed the title Allow both protobuf 3 and 4 in dagster [For 1.2] Allow both protobuf 3 and 4 in dagster Feb 24, 2023
@gibsondan gibsondan requested review from smackesey, alangenfeld and schrockn and removed request for smackesey February 24, 2023 03:07
Copy link
Member

@alangenfeld alangenfeld left a comment

Choose a reason for hiding this comment

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

hard for me to forecast what impact narrowing grpcio from 1.32.0 (Sep 9, 2020) to 1.44.0 (Feb 17, 2022) would have. Min version over a year old seems reasonable I think.

@@ -189,12 +189,12 @@ def _streaming_query(

def ping(self, echo: str):
check.str_param(echo, "echo")
res = self._query("Ping", api_pb2.PingRequest, echo=echo)
res = self._query("Ping", api_pb2.PingRequest, echo=echo) # type: ignore
Copy link
Member

Choose a reason for hiding this comment

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

what exactly are the type errors being suppressed here?

Copy link
Member

Choose a reason for hiding this comment

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

bump

Copy link
Member Author

Choose a reason for hiding this comment

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

See below

Copy link
Member

Choose a reason for hiding this comment

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

brutal - wonder what else we can do to manage this better - maybe our own layer of indirection if the mentioned external libraries are not usable.

@gibsondan
Copy link
Member Author

I'll definitely feel better about bumping the min grpcio pin if we can get the upper bound removed.. 1.44-1.47 is a bit narrow

Comment on lines -1801 to -1810
PingRequest = _reflection.GeneratedProtocolMessageType(
"PingRequest",
(_message.Message,),
{
"DESCRIPTOR": _PINGREQUEST,
"__module__": "api_pb2"
# @@protoc_insertion_point(class_scope:api.PingRequest)
},
)
_sym_db.RegisterMessage(PingRequest)
Copy link
Member Author

Choose a reason for hiding this comment

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

@alangenfeld i think these types were previously explicitly defined and now are generated programatically in some way that pyright can't decipher

We could separately investigate incorporating https://github.com/nipunn1313/mypy-protobuf which apparently works for pyright too, but i had some trouble getting it to work

Copy link
Member Author

Choose a reason for hiding this comment

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

@alangenfeld ^^ this was the response to your bump

Copy link
Collaborator

Choose a reason for hiding this comment

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

i think these types were previously explicitly defined and now are generated programatically in some way that pyright can't decipher

Yeah you can see all those definitions removed i n the large diff of dagster._grpc.__generated__.api_pb2.

I'm kind of curious about mypy-protobuf, I can investigate it later but these ignores look fine for now.

Summary:
Making dagster actually install with protobuf4 also requires removing the grpcio pin since that version is pinned to protobuf3 - so we'll need to resolve the upstream issues with hangs/segfaults before we can do this. This PR tests tox suites with both protobuf4 and protobuf3.
Comment on lines +78 to +79
"grpcio>=1.44.0,<1.48.1",
"grpcio-health-checking>=1.44.0",
Copy link
Member Author

@gibsondan gibsondan Mar 6, 2023

Choose a reason for hiding this comment

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

re - the pins here, one thing i'm not sure about: this new min version is what's needed assuming you want things to keep working if you upgrade to protobuf4, but if you leave the installed protobuf version at 3, you can keep it back at grpcio 1.32.0

i.e. these combos are valid after this PR:
grpcio 1.32.0 / protobuf 3.20.0
grpcio 1.44.0 / protobuf 3.20.0
grpcio 1.44.0 / protobuf 4.22.0

So we could technically leave the >=1.32.0 but that could still result in a combo of libraries that satisfies our constraints but doesn't load correctly

@@ -189,12 +189,12 @@ def _streaming_query(

def ping(self, echo: str):
check.str_param(echo, "echo")
res = self._query("Ping", api_pb2.PingRequest, echo=echo)
res = self._query("Ping", api_pb2.PingRequest, echo=echo) # type: ignore
Copy link
Member

Choose a reason for hiding this comment

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

brutal - wonder what else we can do to manage this better - maybe our own layer of indirection if the mentioned external libraries are not usable.

@gibsondan gibsondan merged commit 589df01 into master Mar 6, 2023
@gibsondan gibsondan deleted the proto4 branch March 6, 2023 17:38
gibsondan added a commit that referenced this pull request Mar 6, 2023
Summary:
This removes the protobuf3 pin in dagster and re-generates our protobuf
api with protobuf 4 (which is mostly backwards compatible with
protobuf3, see below)

Two downsides of this:
- we need to bump our min grpcio version to 1.44 since that's the first
version that is protobuf3 and protobuf4 compatible, and our min version
of protobuf a bit higher. This leaves our grpcio pin fairly narrow until
we can get the upper bound removed once they fix the upstream issues.
- it nukes our pyright typehints for the generated modules

But users have been clamoring for us to remove this protobuf pin so I
think it's worth it
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.

3 participants