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()