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

use a custom yaml loader/dumper for loading and dumping run config, without surprising datetime parsing or octal string behavior #8621

Merged
merged 1 commit into from
Jun 28, 2022

Conversation

gibsondan
Copy link
Member

Summary:
Switching dagit to send and receive data in YAML wasn't quite sufficient to handle weird edge cases that pyyaml handles strangely:

  • datetime-like strings in config are parsed as datetimes, even though that's not a valid dagster config type
  • Octal strings without any 8s or higher in them are bizarrely parsed as integers

This adds a custom yaml loader and dumper that we can customize to change behaviors like this. It digs a little bit into pyyaml internals to do so, but I haven't been able to find another way to customize the default tag behaviors of Pyyaml.

Summary & Motivation

How I Tested These Changes

@vercel
Copy link

vercel bot commented Jun 26, 2022

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

2 Ignored Deployments
Name Status Preview Updated
dagit-storybook ⬜️ Ignored (Inspect) Jun 27, 2022 at 4:59PM (UTC)
dagster ⬜️ Ignored (Inspect) Jun 27, 2022 at 4:59PM (UTC)

@gibsondan gibsondan force-pushed the yamlfun branch 2 times, most recently from 3a8f98c to eeabbce Compare June 26, 2022 21:07
@gibsondan gibsondan marked this pull request as ready for review June 27, 2022 15:25
…ithout surprising datetime parsing or octal string behavior

Summary:
Switching dagit to send and receive data in YAML wasn't quite sufficient to handle weird edge cases that pyyaml handles strangely:
- datetime-like strings in config are parsed as datetimes, even though that's not a valid dagster config type
- Octal strings without any 8s or higher in them are bizarrely parsed as integers

This adds a custom yaml loader and dumper that we can customize to change behaviors like this. It digs a little bit into pyyaml internals to do so, but I haven't been able to find another way to customize the default tag behaviors of Pyyaml.
Copy link
Member

@prha prha left a comment

Choose a reason for hiding this comment

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

This is a good find.

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.

2 participants