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])
| 81 | |
| 82 | |
| 83 | def 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 | |
| 102 | class Executor: |
no test coverage detected