MCPcopy Create free account
hub / github.com/pytorch/executorch / execute

Function execute

backends/cadence/runtime/executor.py:83–99  ·  view source on GitHub ↗

Either a local execution (through subprocess.run) or a remote execution (in Hargow). Run the command described by args (the same way subprocess.run does). Ex: if you want to run "ls -al", you need to pass args = ["ls", "-al"]

(args: List[str])

Source from the content-addressed store, hash-verified

81
82
83def execute(args: List[str]) -> Tuple[str, str]:
84 """
85 Either a local execution (through subprocess.run) or a remote execution (in Hargow).
86 Run the command described by args (the same way subprocess.run does). Ex: if you want to
87 run "ls -al", you need to pass args = ["ls", "-al"]
88 """
89 # `import torch` will mess up PYTHONPATH. delete the messed up PYTHONPATH
90 if "PYTHONPATH" in os.environ:
91 del os.environ["PYTHONPATH"]
92
93 try:
94 return _execute_subprocess(args)
95 except subprocess.CalledProcessError as e:
96 fdb_cmd = f"fdb {' '.join(e.cmd)}"
97 raise RuntimeError(
98 f"Failed to execute. Use the following to debug:\n{fdb_cmd}"
99 ) from e
100
101
102class Executor:

Callers 1

__call__Method · 0.70

Calls 1

_execute_subprocessFunction · 0.85

Tested by

no test coverage detected