Skip to content

Commit

Permalink
Update workflow to take raw command again
Browse files Browse the repository at this point in the history
  • Loading branch information
Raunak Bhagat committed Dec 9, 2024
1 parent 8ab6ccf commit 0f6a686
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
22 changes: 11 additions & 11 deletions .github/ci-scripts/templatize_ray_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ class Metadata(BaseModel, extra="allow"):
parser.add_argument("--daft-version")
parser.add_argument("--python-version", required=True)
parser.add_argument("--cluster-profile", required=True, choices=["debug_xs-x86", "medium-x86"])
parser.add_argument("--working-dir", required=True)
parser.add_argument("--entrypoint-script", required=True)
parser.add_argument("--inline-metadata")
args = parser.parse_args()

content = content.replace(CLUSTER_NAME_PLACEHOLDER, args.cluster_name)
Expand Down Expand Up @@ -101,14 +100,15 @@ class Metadata(BaseModel, extra="allow"):
CLUSTER_PROFILE__VOLUME_MOUNT, profile.volume_mount if profile.volume_mount else NOOP_STEP
)

working_dir = Path(args.working_dir)
assert working_dir.exists() and working_dir.is_dir()
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 = read_inline_metadata.read(f.read())
if metadata:
metadata = Metadata(**metadata)
content = content.replace(OTHER_INSTALL_PLACEHOLDER, " ".join(metadata.dependencies))
if args.inline_metadata:
inline_metadata: Path = args.inline_metadata
assert inline_metadata.exists() and inline_metadata.is_file()
with open(inline_metadata) as f:
metadata = read_inline_metadata.read(f.read())
if metadata:
metadata = Metadata(**metadata)
content = content.replace(OTHER_INSTALL_PLACEHOLDER, " ".join(metadata.dependencies))
else:
content = content.replace(OTHER_INSTALL_PLACEHOLDER, "")

print(content)
16 changes: 7 additions & 9 deletions .github/workflows/run-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,14 @@ on:
type: string
required: false
default: .github/working-dir
entrypoint_script:
description: Entry-point python script (must be inside of the working directory)
command:
description: Command
type: string
required: true
entrypoint_args:
description: Entry-point arguments
inline_metadata:
description: Inline metadata
type: string
required: false
default: ""
env_vars:
description: Environment variables
type: string
Expand Down Expand Up @@ -84,8 +83,7 @@ jobs:
--daft-version '${{ inputs.daft_version }}' \
--python-version '${{ inputs.python_version }}' \
--cluster-profile '${{ inputs.cluster_profile }}' \
--working-dir '${{ inputs.working_dir }}' \
--entrypoint-script '${{ inputs.entrypoint_script }}'
--inline-metadata '${{ inputs.inline_metadata }}'
) >> .github/assets/ray.yaml
cat .github/assets/ray.yaml
- name: Setup ray env vars
Expand Down Expand Up @@ -113,15 +111,15 @@ jobs:
- name: Submit job to ray cluster
run: |
source .venv/bin/activate
if [[ -z '${{ inputs.entrypoint_script }}' ]]; then
if [[ -z '${{ inputs.command }}' ]]; then
echo 'Invalid command submitted; command cannot be empty'
exit 1
fi
ray job submit \
--working-dir ${{ inputs.working_dir }} \
--address http://localhost:8265 \
--runtime-env-json "$ray_env_var" \
-- python ${{ inputs.entrypoint_script }} ${{ inputs.entrypoint_args }}
-- ${{ inputs.command }}
- name: Download log files from ray cluster
run: |
source .venv/bin/activate
Expand Down

0 comments on commit 0f6a686

Please sign in to comment.