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

fix: support ruamel.yaml==0.18.0 [DET-9913] #8228

Merged
merged 1 commit into from
Oct 24, 2023
Merged

Conversation

rb-determined-ai
Copy link
Member

@rb-determined-ai rb-determined-ai commented Oct 23, 2023

There was a breaking change in the ruamel.yaml API, which has the unfortunate effect on our cli of causing commands like det e config to emit absolutely no error message, just exit 1 silently.

Test Plan

  • I manually executed every affected codepath to make sure things looked right

@netlify
Copy link

netlify bot commented Oct 23, 2023

Deploy Preview for determined-ui canceled.

Name Link
🔨 Latest commit 5fcef5b
🔍 Latest deploy log https://app.netlify.com/sites/determined-ui/deploys/65380b63136009000794cde1

@rb-determined-ai rb-determined-ai changed the title fix: support ruamel.yaml==0.18.0 fix: support ruamel.yaml==0.18.0 [DET-9913] Oct 23, 2023
@@ -43,8 +43,7 @@
"python-dateutil",
"pytz",
"tabulate>=0.8.3",
# det preview-search "pretty-dumps" a sub-yaml with an API added in 0.15.29
Copy link
Member Author

Choose a reason for hiding this comment

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

versions older than 0.15.78 don't install with python 3.8, so this pin is no longer relevant.

@rb-determined-ai rb-determined-ai added the to-cherry-pick Pull requests that need to be cherry-picked into the current release label Oct 23, 2023
@rb-determined-ai rb-determined-ai enabled auto-merge (squash) October 23, 2023 22:51
@rb-determined-ai rb-determined-ai removed the to-cherry-pick Pull requests that need to be cherry-picked into the current release label Oct 24, 2023
@rb-determined-ai rb-determined-ai requested a review from a team as a code owner October 24, 2023 17:44
@rb-determined-ai rb-determined-ai self-assigned this Oct 24, 2023
We pinned the ruamel.yaml<0.18.0 in a recent release as a hotfix, but
this is the real fix.
Comment on lines +64 to +81
#
# This strategy isn't a documented API in ruamel.yaml, but it was recommended by the ruamel.yaml
# author in stack overflow[1].
#
# [1] https://stackoverflow.com/a/76870790
class IgnoreUnknownTagConstructor(yaml.SafeConstructor):
def ignore_unknown(self, node: Any) -> None:
return None


LoaderIgnoreUnknown.add_constructor(None, LoaderIgnoreUnknown.ignore_unknown)
IgnoreUnknownTagConstructor.add_constructor(None, IgnoreUnknownTagConstructor.ignore_unknown)


def get_default_cf_parameter(deployment_object: DeterminedDeployment, parameter: str) -> Any:
y = yaml.YAML(typ="safe", pure=True)
y.Constructor = IgnoreUnknownTagConstructor
with open(deployment_object.template_path) as fin:
data = yaml.load(fin, Loader=LoaderIgnoreUnknown)
data = y.load(fin)
Copy link
Member Author

Choose a reason for hiding this comment

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

@ioga please review this specifically

@rb-determined-ai rb-determined-ai merged commit ae839a8 into main Oct 24, 2023
17 of 58 checks passed
@rb-determined-ai rb-determined-ai deleted the rb/ruamel branch October 24, 2023 18:24
rb-determined-ai added a commit that referenced this pull request Oct 24, 2023
@dannysauer dannysauer added this to the 0.26.3 milestone Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants