-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Allow IO manager keys to be StrEnums, not just strs #18623
Comments
Hey @ShootingStarD - are you able to share your full stack trace? |
Hi @sryza here it is :
|
🙏 |
I am open to try to add, during the week-end, the StrEnum classes to the whitelist, will keep you in touch |
@alangenfeld do you have thoughts on whitelisting StrEnums for serdes so they can be used in place of strings? I'm not an expert on StrEnums, but a potential challenge here is that enum classes defined in user code processes will not be present in host processes, which means we wouldn't be able to deserialize them there. |
I think it may be as easy as reordering the cases in edit: well, that naive idea would risk changing the behavior of existing whitelisted |
@alangenfeld Indeed deserializing into a regular string is good for me as it is just an easy way to define strings that will be used throughout my projects. In fact , I will never read the de-serialized values except maybe in the debugger but I don"t mind |
@alangenfeld tested your solution, it passed my testes, will try make a PR this wk, thanks for all the help! |
Pull request in : #18778 |
Can only serialize whitelisted Enums, received JobKeysEnum -> whitelist enums from the StrEnum library
Dagster version
1.5.9
What's the issue?
Hi,
I want to by able to provide StrEnums as keys for various dagster elements such as io_manager, jobs, assets etc. It works well for asset but not for IO manager and Jobs. In fact I manage to reproduce the error for jobs but not for IO manager, eventhough I use the same dagster version.
Nevertheless when I try to execute a Job where the name was defined via a child of StrEnum (from the StrEnum library I get the following error : dagster._serdes.errors.SerializationError:
For me it is important to use StrEnum because :
Like I said, in another project, I get the same error with IO Managers when defining they keys for the resources of a definition
What did you expect to happen?
From what I understand, the error is "just" that StrEnum are not whitelisted. But since they can be treated as strings, I don't see why we could not whitelist them. Would it be possible to do so?
How to reproduce?
assets.py
dagster_keys.py
jobs.py
io_manager.py
definitions.py
tests.py
Like I said previously, I am not able to reproduce the error for the IO Manager keys (and I cannot share it since it is from my company)
Deployment type
None
Deployment details
No response
Additional information
I haven't tried to use the Python 3.11 StrEnum but even if it works, our production is still on python 3.9 and a migration is not possible at the moment
Message from the maintainers
Impacted by this issue? Give it a 👍! We factor engagement into prioritization.
The text was updated successfully, but these errors were encountered: