Only use git repo if .git exists (#5701)

This commit is contained in:
Stephanie Wang
2019-09-13 11:34:34 -07:00
committed by Philipp Moritz
parent 07c4c6367a
commit 1d4a11a433
2 changed files with 10 additions and 6 deletions
+3
View File
@@ -93,6 +93,9 @@ class ProjectDefinition:
return command_to_run
def git_repo(self):
return self.config.get("repo", None)
def find_root(directory):
"""Find root directory of the ray project.
+7 -6
View File
@@ -101,12 +101,13 @@ def create(project_name, cluster_yaml, requirements):
requirements = REQUIREMENTS_TXT
repo = None
try:
repo = subprocess.check_output(
"git remote get-url origin".split(" ")).strip()
logger.info("Setting repo URL to %s", repo)
except subprocess.CalledProcessError:
pass
if os.path.exists(".git"):
try:
repo = subprocess.check_output(
"git remote get-url origin".split(" ")).strip()
logger.info("Setting repo URL to %s", repo)
except subprocess.CalledProcessError:
pass
with open(PROJECT_TEMPLATE) as f:
project_template = f.read()