From 1d4a11a433d09f645b34a5bf6844bdd975935fcf Mon Sep 17 00:00:00 2001 From: Stephanie Wang Date: Fri, 13 Sep 2019 11:34:34 -0700 Subject: [PATCH] Only use git repo if .git exists (#5701) --- python/ray/projects/projects.py | 3 +++ python/ray/projects/scripts.py | 13 +++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/python/ray/projects/projects.py b/python/ray/projects/projects.py index 39e628331..86127922b 100644 --- a/python/ray/projects/projects.py +++ b/python/ray/projects/projects.py @@ -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. diff --git a/python/ray/projects/scripts.py b/python/ray/projects/scripts.py index 5d2c10bf6..6feea681e 100644 --- a/python/ray/projects/scripts.py +++ b/python/ray/projects/scripts.py @@ -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()