Skip to content

Commit

Permalink
Rework subprocess usage for Linux.
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottTodd committed Jan 17, 2025
1 parent 61d5bc2 commit e4b80c8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/test_onnx_models.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ jobs:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Install Git LFS
run: sudo apt install -y git-lfs

# Install Python packages.
- name: Setup Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
Expand Down
9 changes: 4 additions & 5 deletions onnx_models/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,14 @@ def __init__(
def setup_github_repository(self, repository_name: str, clone_method: str):
logger.info(f"Setting up GitHub repository '{repository_name}'")

# Command does not exist on GitHub-hosted Linux runners?
# logger.info("Checking for working 'git lfs' (https://git-lfs.com/)")
# subprocess.run("git lfs env", capture_output=True, check=True)
logger.info("Checking for working 'git lfs' (https://git-lfs.com/)")
subprocess.run(["git", "lfs", "env"], capture_output=True, check=True)

# Skip if the directory already exists (and is a git directory).
if self.local_repository_dir.is_dir():
logger.info(f"Directory '{self.local_repository_dir}' already exists")
subprocess.run(
"git rev-parse --is-inside-work-tree",
["git", "rev-parse", "--is-inside-work-tree"],
cwd=self.local_repository_dir,
capture_output=True,
check=True,
Expand All @@ -136,7 +135,7 @@ def setup_github_repository(self, repository_name: str, clone_method: str):
remote_url = f"[email protected]:{repository_name}.git"
logger.info(f"Cloning {remote_url} into '{self.local_repository_dir}'")
subprocess.run(
f"git clone {remote_url} {self.local_repository_dir}", check=True
["git", "clone", remote_url, self.local_repository_dir], check=True
)

def pull_lfs_file(self, file_relative_path: str):
Expand Down
2 changes: 1 addition & 1 deletion onnx_models/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def import_onnx_model_to_mlir(onnx_path: Path) -> Path:
f"Running import command:\n" #
f" {import_cmd}"
)
ret = subprocess.run(import_cmd, capture_output=True)
ret = subprocess.run(import_cmd, shell=True, capture_output=True)
if ret.returncode != 0:
logger.error(f"Import of '{onnx_path.name}' failed!")
logger.error("iree-import-onnx stdout:")
Expand Down

0 comments on commit e4b80c8

Please sign in to comment.