-
Notifications
You must be signed in to change notification settings - Fork 6k
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
[Project] Implementing Project CLI #5397
Conversation
python/ray/projects/scripts.py
Outdated
print(proj) | ||
except (jsonschema.exceptions.ValidationError, ValueError) as e: | ||
print("💔 Validation failed for the following reason", file=sys.stderr) | ||
raise e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try raising click exceptions; you won't see the stack trace
python/ray/projects/scripts.py
Outdated
PROJECT_DIR = ".rayproject" | ||
PROJECT_YAML = os.path.join(PROJECT_DIR, "project.yaml") | ||
CLUSTER_YAML = os.path.join(PROJECT_DIR, "cluster.yaml") | ||
REQ_TXT = os.path.join(PROJECT_DIR, "requirements.txt") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's go with REQUIREMENTS_TXT here to not be too cryptic :)
import logging | ||
import os | ||
import sys | ||
from shutil import copyfile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this available by default? Are we using it anywhere else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. The following files use it:
python/setup.py
rllib/tests/test_checkpoint_restore.py
rllib/tests/test_io.py
python/ray/projects/scripts.py
python/ray/tests/test_basic.py
python/ray/tests/test_autoscaler.py
python/ray/tests/test_tempfile.py
python/ray/tune/trainable.py
python/ray/tune/tests/test_tune_restore.py
python/ray/tune/tests/test_trial_scheduler.py
python/ray/tune/tests/test_experiment_analysis.py
python/ray/tune/tests/test_trial_runner.py
python/ray/tune/tests/test_cluster.py
python/ray/tune/schedulers/pbt.py
I think we can safely assume it exists
python/ray/projects/schema.json
Outdated
"name", | ||
"cluster" | ||
] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should have trailing newlines (also in the other files, maybe you can configure your editor to add it)
python/ray/projects/scripts.py
Outdated
# requirements.txt | ||
_THIS_FILE_DIR = os.path.split(os.path.abspath(__file__))[0] | ||
_TEMPLATE_DIR = os.path.join(_THIS_FILE_DIR, "templates") | ||
PROJECT_TMPL = os.path.join(_TEMPLATE_DIR, "project_template.yaml") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd go with PROJECT_TEMPLATE here
@@ -43,6 +46,12 @@ | |||
"ray/autoscaler/local/example-full.yaml", | |||
] | |||
|
|||
ray_project_files = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
# dockerimage: The docker image to be used to run the project in. Like ubuntu:18.04 | ||
requirements: {{requirements}} | ||
|
||
shell: # shell commands to be ran for environment setup. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shell -> # Shell
- echo "Setting up the environment" | ||
|
||
commands: | ||
- name: first command |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
command names shouldn't include spaces (replace with first-command?)
python/ray/projects/scripts.py
Outdated
"--verbose", help="If set, print the validated file", is_flag=True) | ||
def validate(verbose): | ||
try: | ||
proj = ray.projects.load_project(os.getcwd()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
proj -> project
python/ray/projects/scripts.py
Outdated
requirements = REQ_TXT | ||
|
||
with open(PROJECT_TMPL) as f: | ||
proj_tmpl = f.read() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
proj_tmpl -> project_template
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree here - in general, would be good to be more verbose
Test PASSed. |
Test PASSed. |
python/ray/projects/scripts.py
Outdated
cluster_yaml = CLUSTER_YAML | ||
|
||
if requirements is None: | ||
logging.warn("Using default requirements.txt") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logger = logging.getLogger
?
python/ray/projects/scripts.py
Outdated
REQ_TXT_TMPL = os.path.join(_TEMPLATE_DIR, "requirements.txt") | ||
|
||
|
||
@click.group("project", help="Commands working with ray project") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this needs a better help string. @pcmoritz?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, can you mark this explicitly as experimental?
@@ -0,0 +1,101 @@ | |||
import logging |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
py2to3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a page to the docs for this marking it as experimental?
@richardliaw I believe @pcmoritz is adding docs in following up PR. Experimental is marked here:
|
Test FAILed. |
Test FAILed. |
Test PASSed. |
Test PASSed. |
Test PASSed. |
Test PASSed. |
Test PASSed. |
What do these changes do?
Related issue number
Linter
scripts/format.sh
to lint the changes in this PR.