Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/type_hints' into type_hints
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-janssen committed Mar 18, 2024
2 parents 142dccd + 84e2f97 commit 019764a
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pympipool/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def __init__(
init_function: callable = None,
cwd: str = None,
executor=None,
hostname_localhost: bool =False,
hostname_localhost: bool = False,
):
# Use __new__() instead of __init__(). This function is only implemented to enable auto-completion.
pass
Expand Down
12 changes: 9 additions & 3 deletions pympipool/shared/backend.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import inspect


def call_funct(input_dict: dict, funct: callable = None, memory: dict = None) -> callable:
def call_funct(
input_dict: dict, funct: callable = None, memory: dict = None
) -> callable:
"""
Call function from dictionary
Expand Down Expand Up @@ -50,7 +52,9 @@ def parse_arguments(argument_lst: list[str]) -> dict:
)


def update_default_dict_from_arguments(argument_lst: list[str], argument_dict: dict, default_dict: dict) -> dict:
def update_default_dict_from_arguments(
argument_lst: list[str], argument_dict: dict, default_dict: dict
) -> dict:
default_dict.update(
{
k: argument_lst[argument_lst.index(v) + 1]
Expand All @@ -61,7 +65,9 @@ def update_default_dict_from_arguments(argument_lst: list[str], argument_dict: d
return default_dict


def _update_dict_delta(dict_input: dict, dict_output: dict, keys_possible_lst: list) -> dict:
def _update_dict_delta(
dict_input: dict, dict_output: dict, keys_possible_lst: list
) -> dict:
return {
k: v
for k, v in dict_input.items()
Expand Down
4 changes: 3 additions & 1 deletion pympipool/shared/executorbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,9 @@ def execute_parallel_tasks(
)


def execute_parallel_tasks_loop(interface, future_queue: queue.Queue, init_function: callable = None):
def execute_parallel_tasks_loop(
interface, future_queue: queue.Queue, init_function: callable = None
):
if init_function is not None:
interface.send_dict(
input_dict={"init": True, "fn": init_function, "args": (), "kwargs": {}}
Expand Down
4 changes: 2 additions & 2 deletions pympipool/shared/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def __init__(
threads_per_core: int = 1,
gpus_per_core: int = 0,
oversubscribe: bool = False,
command_line_argument_lst: list[str] = [],
command_line_argument_lst: list[str] = [],
):
super().__init__(
cwd=cwd,
Expand All @@ -101,7 +101,7 @@ def generate_command(self, command_lst: list[str]) -> list[str]:
)


def generate_mpiexec_command(cores: int, oversubscribe: bool=False) -> list[str]:
def generate_mpiexec_command(cores: int, oversubscribe: bool = False) -> list[str]:
if cores == 1:
return []
else:
Expand Down
7 changes: 6 additions & 1 deletion pympipool/shell/interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,12 @@ def __init__(self, *args, **kwargs):
)
self._future_queue.put({"init": True, "args": args, "kwargs": kwargs})

def submit(self, string_input: str, lines_to_read: int = None, stop_read_pattern: str = None):
def submit(
self,
string_input: str,
lines_to_read: int = None,
stop_read_pattern: str = None,
):
"""
Submit the input as a string to the executable. In addition to the input the ShellExecutor also needs a measure
to identify the completion of the execution. This can either be provided based on the number of lines to read
Expand Down
2 changes: 1 addition & 1 deletion pympipool/slurm/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def __init__(
init_function: callable = None,
cwd: str = None,
hostname_localhost: bool = False,
command_line_argument_lst: list[str] = [],
command_line_argument_lst: list[str] = [],
):
super().__init__()
self._set_process(
Expand Down

0 comments on commit 019764a

Please sign in to comment.