Skip to content

Commit

Permalink
fix(run-cluster-workflow): Add null check when parsing metadata (#3507)
Browse files Browse the repository at this point in the history
# Overview
When parsing a python script's inline metadata, add a null-check if the
file contains no metadata.
  • Loading branch information
Raunak Bhagat authored Dec 6, 2024
1 parent 0889bbf commit 3a8cece
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions .github/ci-scripts/templatize_ray_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,9 @@ class Metadata(BaseModel, extra="allow"):
entrypoint_script_fullpath: Path = working_dir / args.entrypoint_script
assert entrypoint_script_fullpath.exists() and entrypoint_script_fullpath.is_file()
with open(entrypoint_script_fullpath) as f:
metadata = Metadata(**read_inline_metadata.read(f.read()))

content = content.replace(OTHER_INSTALL_PLACEHOLDER, " ".join(metadata.dependencies))
metadata = read_inline_metadata.read(f.read())
if metadata:
metadata = Metadata(**metadata)
content = content.replace(OTHER_INSTALL_PLACEHOLDER, " ".join(metadata.dependencies))

print(content)

0 comments on commit 3a8cece

Please sign in to comment.