Skip to content

Removing CLI AppWrapper Generation #2

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

Merged
merged 2 commits into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 1 addition & 121 deletions src/codeflare_sdk/utils/generate_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import argparse
import uuid
from kubernetes import client, config
from codeflare_sdk.utils.kube_api_helpers import _kube_api_error_handling
from .kube_api_helpers import _kube_api_error_handling


def read_template(template):
Expand Down Expand Up @@ -332,123 +332,3 @@ def generate_appwrapper(
outfile = appwrapper_name + ".yaml"
write_user_appwrapper(user_yaml, outfile)
return outfile


def main(): # pragma: no cover
parser = argparse.ArgumentParser(description="Generate user AppWrapper")
parser.add_argument(
"--name",
required=False,
default="",
help="User selected name for AppWrapper and Ray Cluster (auto-generated if not provided)",
)
parser.add_argument(
"--min-cpu",
type=int,
required=True,
help="min number of CPU(s) in a worker required for running job",
)
parser.add_argument(
"--max-cpu",
type=int,
required=True,
help="max number of CPU(s) in a worker required for running job",
)
parser.add_argument(
"--min-memory",
type=int,
required=True,
help="min RAM required in a worker for running job, in GB",
)
parser.add_argument(
"--max-memory",
type=int,
required=True,
help="max RAM required in a worker for running job, in GB",
)
parser.add_argument(
"--gpu",
type=int,
required=True,
help="GPU(s) required in a worker for running job",
)
parser.add_argument(
"--workers",
type=int,
required=True,
help="How many workers are required in the cluster",
)
parser.add_argument(
"--template", required=True, help="Template AppWrapper yaml file"
)
parser.add_argument(
"--image",
required=False,
default="rayproject/ray:latest",
help="Ray image to be used (defaults to rayproject/ray:latest)",
)
parser.add_argument(
"--instascale",
default=False,
required=False,
action="store_true",
help="Indicates that instascale is installed on the cluster",
)
parser.add_argument(
"--instance-types",
type=str,
nargs="+",
default=[],
required=False,
help="Head,worker instance types (space separated)",
)
parser.add_argument(
"--namespace",
required=False,
default="default",
help="Set the kubernetes namespace you want to deploy your cluster to. Default. If left blank, uses the 'default' namespace",
)
parser.add_argument(
"--local-interactive",
required=False,
default=False,
help="Enable local interactive mode",
)

args = parser.parse_args()
name = args.name
min_cpu = args.min_cpu
max_cpu = args.max_cpu
min_memory = args.min_memory
max_memory = args.max_memory
gpu = args.gpu
workers = args.workers
template = args.template
image = args.image
instascale = args.instascale
instance_types = args.instance_types
namespace = args.namespace
local_interactive = args.local_interactive
env = {}

outfile = generate_appwrapper(
name,
namespace,
min_cpu,
max_cpu,
min_memory,
max_memory,
gpu,
workers,
template,
image,
instascale,
instance_types,
local_interactive,
env,
)
return outfile


if __name__ == "__main__": # pragma: no cover
main()
171 changes: 0 additions & 171 deletions tests/test-case-cmd.yaml

This file was deleted.

15 changes: 2 additions & 13 deletions tests/unit_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2258,20 +2258,9 @@ def test_export_env():
)


# Make sure to keep this function and the following function at the end of the file
def test_cmd_line_generation():
os.system(
f"python3 {parent}/src/codeflare_sdk/utils/generate_yaml.py --name=unit-cmd-cluster --min-cpu=1 --max-cpu=1 --min-memory=2 --max-memory=2 --gpu=1 --workers=2 --template=src/codeflare_sdk/templates/base-template.yaml"
)
assert filecmp.cmp(
"unit-cmd-cluster.yaml", f"{parent}/tests/test-case-cmd.yaml", shallow=True
)
os.remove("unit-test-cluster.yaml")
os.remove("unit-test-default-cluster.yaml")
os.remove("unit-cmd-cluster.yaml")


# Make sure to always keep this function last
def test_cleanup():
os.remove("unit-test-cluster.yaml")
os.remove("unit-test-default-cluster.yaml")
os.remove("test.yaml")
os.remove("raytest2.yaml")