from typing import Any, Callable, Dict, List, Optional, Set
import cloudpickle # type: ignore
from typing import Any, Callable, Dict, List, Optional, Set
import cloudpickle # type: ignore
from ansi import bg, fg, underline, reset
import argparse_utils
from ansi import bg, fg, underline, reset
import argparse_utils
def shutdown(self, wait=True) -> None:
logger.debug(f'Shutting down processpool executor {self.title}')
self._process_executor.shutdown(wait)
def shutdown(self, wait=True) -> None:
logger.debug(f'Shutting down processpool executor {self.title}')
self._process_executor.shutdown(wait)
self.policy.register_worker_pool(self.workers)
self.cv = threading.Condition()
self._helper_executor = fut.ThreadPoolExecutor(
self.policy.register_worker_pool(self.workers)
self.cv = threading.Condition()
self._helper_executor = fut.ThreadPoolExecutor(
self.status.record_acquire_worker(worker, uuid)
logger.debug(f'Running bundle {uuid} on {worker}...')
self.status.record_acquire_worker(worker, uuid)
logger.debug(f'Running bundle {uuid} on {worker}...')
return None
# Send input to machine if it's not local.
if hostname not in machine:
cmd = f'{RSYNC} {bundle.code_file} {username}@{machine}:{bundle.code_file}'
return None
# Send input to machine if it's not local.
if hostname not in machine:
cmd = f'{RSYNC} {bundle.code_file} {username}@{machine}:{bundle.code_file}'
f' /home/scott/lib/python_modules/remote_worker.py'
f' --code_file {bundle.code_file} --result_file {bundle.result_file}"')
p = cmd_in_background(cmd, silent=True)
bundle.pid = pid = p.pid
f' /home/scott/lib/python_modules/remote_worker.py'
f' --code_file {bundle.code_file} --result_file {bundle.result_file}"')
p = cmd_in_background(cmd, silent=True)
bundle.pid = pid = p.pid
# Whether original or backup, if we finished first we must
# fetch the results if the computation happened on a
# Whether original or backup, if we finished first we must
# fetch the results if the computation happened on a
if bundle.hostname not in bundle.machine:
cmd = f'{RSYNC} {username}@{machine}:{result_file} {result_file} 2>/dev/null'
logger.info(
if bundle.hostname not in bundle.machine:
cmd = f'{RSYNC} {username}@{machine}:{result_file} {result_file} 2>/dev/null'
logger.info(
from string_utils import generate_uuid
uuid = generate_uuid(as_hex=True)
code_file = f'/tmp/{uuid}.code.bin'
from string_utils import generate_uuid
uuid = generate_uuid(as_hex=True)
code_file = f'/tmp/{uuid}.code.bin'
backup_bundle = BundleDetails(
pickled_code = src_bundle.pickled_code,
uuid = uuid,
backup_bundle = BundleDetails(
pickled_code = src_bundle.pickled_code,
uuid = uuid,
)
src_bundle.backup_bundles.append(backup_bundle)
self.status.record_bundle_details_already_locked(backup_bundle)
)
src_bundle.backup_bundles.append(backup_bundle)
self.status.record_bundle_details_already_locked(backup_bundle)
# they will move the result_file to this machine and let
# the original pick them up and unpickle them.
# they will move the result_file to this machine and let
# the original pick them up and unpickle them.
self.total_bundles_submitted += 1
return self._helper_executor.submit(self.launch, bundle)
self.total_bundles_submitted += 1
return self._helper_executor.submit(self.launch, bundle)
def shutdown(self, wait=True) -> None:
self._helper_executor.shutdown(wait)
logging.debug(f'Shutting down RemoteExecutor {self.title}')
def shutdown(self, wait=True) -> None:
self._helper_executor.shutdown(wait)
logging.debug(f'Shutting down RemoteExecutor {self.title}')