Skip to content

Commit

Permalink
Submit daft repo instead of using wheel
Browse files Browse the repository at this point in the history
  • Loading branch information
Raunak Bhagat committed Dec 4, 2024
1 parent 210b6b8 commit d9c1204
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 39 deletions.
27 changes: 5 additions & 22 deletions .github/ci-scripts/templatize_ray_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

CLUSTER_NAME_PLACEHOLDER = "\\{{CLUSTER_NAME}}"
DAFT_INSTALL_PLACEHOLDER = "\\{{DAFT_INSTALL}}"
OTHER_INSTALL_PLACEHOLDER = "\{{OTHER_INSTALLS}}"
OTHER_INSTALL_PLACEHOLDER = "\\{{OTHER_INSTALLS}}"
PYTHON_VERSION_PLACEHOLDER = "\\{{PYTHON_VERSION}}"
CLUSTER_PROFILE__NODE_COUNT = "\\{{CLUSTER_PROFILE/node_count}}"
CLUSTER_PROFILE__INSTANCE_TYPE = "\\{{CLUSTER_PROFILE/instance_type}}"
Expand Down Expand Up @@ -68,28 +68,14 @@ class Metadata(BaseModel, extra="allow"):

parser = ArgumentParser()
parser.add_argument("--cluster-name", required=True)
parser.add_argument("--daft-wheel-url")
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("--script", required=True)
args = parser.parse_args()

content = content.replace(CLUSTER_NAME_PLACEHOLDER, args.cluster_name)

if args.daft_wheel_url and args.daft_version:
raise ValueError(
"Cannot specify both the `daft-wheel-name` and the `daft-version`; please choose one or the other"
)
elif args.daft_wheel_url:
daft_install = args.daft_wheel_url
elif args.daft_version:
daft_install = f"getdaft=={args.daft_version}"
else:
daft_install = "getdaft"
content = content.replace(DAFT_INSTALL_PLACEHOLDER, daft_install)

content = content.replace(DAFT_INSTALL_PLACEHOLDER, f"getdaft=={args.daft_version}" if args.daft_version else "")
content = content.replace(PYTHON_VERSION_PLACEHOLDER, args.python_version)

profile = profiles[args.cluster_profile]
Expand All @@ -101,11 +87,8 @@ 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:
assert Path(args.script).exists()
with open(args.script) as f:
metadata = Metadata(**read_inline_metadata.read(f.read()))

content = content.replace(OTHER_INSTALL_PLACEHOLDER, " ".join(metadata.dependencies))
Expand Down
23 changes: 6 additions & 17 deletions .github/workflows/run-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ name: run-cluster
on:
workflow_dispatch:
inputs:
daft_wheel_url:
description: Daft python-wheel URL
type: string
required: false
daft_version:
description: Daft version (errors if both this and "Daft python-wheel URL" are provided)
type: string
Expand All @@ -24,16 +20,11 @@ on:
- debug_xs-x86
required: false
default: medium-x86
working_dir:
description: Working directory
type: string
required: false
default: .github/working-dir
entrypoint_script:
script:
description: Entry-point python script (must be inside of the working directory)
type: string
required: true
entrypoint_args:
args:
description: Entry-point arguments
type: string
required: false
Expand Down Expand Up @@ -75,12 +66,10 @@ jobs:
--python 3.12 \
.github/ci-scripts/templatize_ray_config.py \
--cluster-name "ray-ci-run-${{ github.run_id }}_${{ github.run_attempt }}" \
--daft-wheel-url '${{ inputs.daft_wheel_url }}' \
--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 }}'
--script '${{ inputs.script }}'
) >> .github/assets/ray.yaml
cat .github/assets/ray.yaml
- name: Download private ssh key
Expand All @@ -99,15 +88,15 @@ jobs:
- name: Submit job to ray cluster
run: |
source .venv/bin/activate
if [[ -z '${{ inputs.entrypoint_script }}' ]]; then
if [[ -z '${{ inputs.script }}' ]]; then
echo 'Invalid command submitted; command cannot be empty'
exit 1
fi
ray job submit \
--working-dir ${{ inputs.working_dir }} \
--working-dir . \
--address http://localhost:8265 \
--runtime-env-json '{"env_vars": {"DAFT_ENABLE_RAY_TRACING": "1"}}' \
-- python ${{ inputs.entrypoint_script }} ${{ inputs.entrypoint_args }}
-- python ${{ inputs.script }} ${{ inputs.args }}
- name: Download log files from ray cluster
run: |
source .venv/bin/activate
Expand Down

0 comments on commit d9c1204

Please sign in to comment.