def publish_results(exp_name, results_dir): import logging log = logging.getLogger("sts.exp_lifecycle") res_git_dir = find_git_dir(results_dir) rel_results_dir = os.path.relpath(results_dir, res_git_dir) log.info("Publishing results to git dir "+res_git_dir) system("git add %s" % rel_results_dir, cwd=res_git_dir) system("git commit -m '%s'" % exp_name, cwd=res_git_dir) system("git pull --rebase", cwd=res_git_dir) system("git push", cwd=res_git_dir)
def git_has_uncommitted_files(d): return system("git diff-files --quiet --ignore-submodules --", cwd=d) > 0 \ or system("git diff-index --cached --quiet HEAD --ignore-submodules --", cwd=d) > 0