diff options
| author | Scott Gasch <[email protected]> | 2021-07-08 22:25:12 -0700 |
|---|---|---|
| committer | Scott Gasch <[email protected]> | 2021-07-08 22:25:12 -0700 |
| commit | 11eeb8574b7b4620ac6fd440cb251f8aa2458f5b (patch) | |
| tree | 97f8e64eddd4528b01af58df269427814b889929 /executors.py | |
| parent | e516059c716537259c601c022cc3bad44025385e (diff) | |
Reduce import scopes, remove cycles.
Diffstat (limited to 'executors.py')
| -rw-r--r-- | executors.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/executors.py b/executors.py index 2b2f025..2f4cf83 100644 --- a/executors.py +++ b/executors.py @@ -21,10 +21,9 @@ import cloudpickle # type: ignore from ansi import bg, fg, underline, reset import argparse_utils import config -import exec_utils +from exec_utils import run_silently, cmd_in_background from decorator_utils import singleton import histogram -import string_utils logger = logging.getLogger(__name__) @@ -599,14 +598,14 @@ class RemoteExecutor(BaseExecutor): if hostname not in machine: cmd = f'{RSYNC} {bundle.code_file} {username}@{machine}:{bundle.code_file}' logger.info(f"Copying work to {worker} via {cmd}") - exec_utils.run_silently(cmd) + run_silently(cmd) # Do it. cmd = (f'{SSH} {bundle.username}@{bundle.machine} ' f'"source remote-execution/bin/activate &&' f' /home/scott/lib/python_modules/remote_worker.py' f' --code_file {bundle.code_file} --result_file {bundle.result_file}"') - p = exec_utils.cmd_in_background(cmd, silent=True) + p = cmd_in_background(cmd, silent=True) bundle.pid = pid = p.pid logger.info(f"Running {cmd} in the background as process {pid}") @@ -657,11 +656,11 @@ class RemoteExecutor(BaseExecutor): f"Fetching results from {username}@{machine} via {cmd}" ) try: - exec_utils.run_silently(cmd) + run_silently(cmd) except subprocess.CalledProcessError: pass - exec_utils.run_silently(f'{SSH} {username}@{machine}' - f' "/bin/rm -f {code_file} {result_file}"') + run_silently(f'{SSH} {username}@{machine}' + f' "/bin/rm -f {code_file} {result_file}"') bundle.end_ts = time.time() assert bundle.worker is not None self.status.record_release_worker_already_locked( @@ -729,7 +728,8 @@ class RemoteExecutor(BaseExecutor): return result def create_original_bundle(self, pickle): - uuid = string_utils.generate_uuid(as_hex=True) + from string_utils import generate_uuid + uuid = generate_uuid(as_hex=True) code_file = f'/tmp/{uuid}.code.bin' result_file = f'/tmp/{uuid}.result.bin' |
