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

Ensure all temp files are deleted after the compatibility test #886

Merged
merged 3 commits into from
Jan 30, 2023

Conversation

Yicheng-Lu-llll
Copy link
Contributor

@Yicheng-Lu-llll Yicheng-Lu-llll commented Jan 28, 2023

Why are these changes needed?

  1. This PR ensures all temp files are removed after the compatibility tests are completed. In the current implementation, some temporary files will not be deleted after the process exits due to:

    with tempfile.NamedTemporaryFile('w', delete=False) as ray_cluster_yaml:

    With the option delete=False, the temporary files will not be deleted after the process exits, and need to be deleted manually. See NamedTemporaryFile for more details. Check /tmp to see the temporary files after the tests are completed.

    In this PR, temporary files will be deleted automatically once we close the files. See how NamedTemporaryFile works.

    with tempfile.NamedTemporaryFile('w', suffix = '_ray_cluster_yaml') as ray_cluster_yaml:
            ray_cluster_yaml.write(yamlfile)
            ray_cluster_yaml.flush()
  • Note: We need to add a flush manually. Otherwise, the file will be empty when we try to read it because the flush normally does not happen until the file is closed.
  1. This PR removes redundant try/catch. RayServiceAddCREvent and RayClusterAddCREvent already have the logic to raise and log errors.

Related issue number

Checks

Make sure the compatibility tests still work. This can be proven through the CI test.

  • I've made sure the tests are passing.
  • Testing Strategy
    • Unit tests
    • Manual tests
    • This PR is not tested :(

@Yicheng-Lu-llll Yicheng-Lu-llll marked this pull request as ready for review January 28, 2023 05:24
tests/kuberay_utils/utils.py Outdated Show resolved Hide resolved
tests/kuberay_utils/utils.py Show resolved Hide resolved
Copy link
Member

@kevin85421 kevin85421 left a comment

Choose a reason for hiding this comment

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

LGTM

@kevin85421 kevin85421 merged commit dbcc686 into ray-project:master Jan 30, 2023
@kevin85421
Copy link
Member

The CI failure is due to #852.

lowang-bh pushed a commit to lowang-bh/kuberay that referenced this pull request Sep 24, 2023
…roject#886)

This PR ensures all temp files are removed after the compatibility tests are completed. In the current implementation, some temporary files will not be deleted after the process exits.
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.

None yet

2 participants