Skip to content
This repository has been archived by the owner on Oct 10, 2023. It is now read-only.

Commit

Permalink
run black formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
Roulbac committed Aug 17, 2023
1 parent 320e20f commit ced63af
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions flojoy/flojoy_node_venv.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ def TORCH_NODE(default: Matrix) -> Matrix:
__all__ = ["run_in_venv"]



@contextmanager
def swap_sys_path(venv_executable: os.PathLike, extra_sys_path: list[str] = None):
"""Temporarily swap the sys.path of the child process with the sys.path of the parent process."""
Expand All @@ -56,7 +55,6 @@ def swap_sys_path(venv_executable: os.PathLike, extra_sys_path: list[str] = None
sys.path = old_path



def _install_pip_dependencies(
venv_executable: os.PathLike, pip_dependencies: tuple[str], verbose: bool = False
):
Expand Down Expand Up @@ -101,7 +99,9 @@ def __init__(
self._venv_executable = venv_executable

def __call__(self, *args_serialized, **kwargs_serialized):
with swap_sys_path(venv_executable=self._venv_executable, extra_sys_path=self._extra_sys_path):
with swap_sys_path(
venv_executable=self._venv_executable, extra_sys_path=self._extra_sys_path
):
try:
fn = cloudpickle.loads(self._func_serialized)
args = [cloudpickle.loads(arg) for arg in args_serialized]
Expand Down Expand Up @@ -204,7 +204,7 @@ def decorator(func):
def wrapper(*args, **kwargs):
# Generate a new multiprocessing context for the parent process in "spawn" mode
parent_mp_context = multiprocessing.get_context("spawn")
parent_conn, child_conn = parent_mp_context.Pipe()
parent_conn, child_conn = parent_mp_context.Pipe()
# Serialize function arguments using cloudpickle
args_serialized = [cloudpickle.dumps(arg) for arg in args]
kwargs_serialized = {
Expand Down

0 comments on commit ced63af

Please sign in to comment.