Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions executorlib/executor/flux.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from executorlib.standalone.inputcheck import (
check_command_line_argument_lst,
check_init_function,
check_log_obj_size,
check_oversubscribe,
check_plot_dependency_graph,
check_pmi,
Expand Down Expand Up @@ -246,6 +247,7 @@ class FluxClusterExecutor(BaseExecutor):
plot_dependency_graph (bool): Plot the dependencies of multiple future objects without executing them. For
debugging purposes and to get an overview of the specified dependencies.
plot_dependency_graph_filename (str): Name of the file to store the plotted graph in.
log_obj_size (bool): Enable debug mode which reports the size of the communicated objects.

Examples:
```
Expand Down Expand Up @@ -282,6 +284,7 @@ def __init__(
refresh_rate: float = 0.01,
plot_dependency_graph: bool = False,
plot_dependency_graph_filename: Optional[str] = None,
log_obj_size: bool = False,
):
"""
The executorlib.FluxClusterExecutor leverages either the message passing interface (MPI), the SLURM workload
Expand Down Expand Up @@ -323,6 +326,7 @@ def __init__(
plot_dependency_graph (bool): Plot the dependencies of multiple future objects without executing them. For
debugging purposes and to get an overview of the specified dependencies.
plot_dependency_graph_filename (str): Name of the file to store the plotted graph in.
log_obj_size (bool): Enable debug mode which reports the size of the communicated objects.

"""
default_resource_dict: dict = {
Expand All @@ -338,6 +342,7 @@ def __init__(
resource_dict.update(
{k: v for k, v in default_resource_dict.items() if k not in resource_dict}
)
check_log_obj_size(log_obj_size=log_obj_size)
if not plot_dependency_graph:
import pysqa # noqa

Expand Down
5 changes: 5 additions & 0 deletions executorlib/executor/slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from executorlib.executor.base import BaseExecutor
from executorlib.standalone.inputcheck import (
check_init_function,
check_log_obj_size,
check_plot_dependency_graph,
check_refresh_rate,
validate_number_of_cores,
Expand Down Expand Up @@ -58,6 +59,7 @@ class SlurmClusterExecutor(BaseExecutor):
plot_dependency_graph (bool): Plot the dependencies of multiple future objects without executing them. For
debugging purposes and to get an overview of the specified dependencies.
plot_dependency_graph_filename (str): Name of the file to store the plotted graph in.
log_obj_size (bool): Enable debug mode which reports the size of the communicated objects.

Examples:
```
Expand Down Expand Up @@ -94,6 +96,7 @@ def __init__(
refresh_rate: float = 0.01,
plot_dependency_graph: bool = False,
plot_dependency_graph_filename: Optional[str] = None,
log_obj_size: bool = False,
):
"""
The executorlib.SlurmClusterExecutor leverages either the message passing interface (MPI), the SLURM workload
Expand Down Expand Up @@ -135,6 +138,7 @@ def __init__(
plot_dependency_graph (bool): Plot the dependencies of multiple future objects without executing them. For
debugging purposes and to get an overview of the specified dependencies.
plot_dependency_graph_filename (str): Name of the file to store the plotted graph in.
log_obj_size (bool): Enable debug mode which reports the size of the communicated objects.

"""
default_resource_dict: dict = {
Expand All @@ -150,6 +154,7 @@ def __init__(
resource_dict.update(
{k: v for k, v in default_resource_dict.items() if k not in resource_dict}
)
check_log_obj_size(log_obj_size=log_obj_size)
if not plot_dependency_graph:
import pysqa # noqa

Expand Down
14 changes: 14 additions & 0 deletions executorlib/standalone/inputcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,21 @@ def validate_number_of_cores(


def check_file_exists(file_name: Optional[str]):
"""
Check if file exists and raise a ValueError if it does not or file_name is None.
"""
if file_name is None:
raise ValueError("file_name is not set.")
if not os.path.exists(file_name):
raise ValueError("file_name is not written to the file system.")


def check_log_obj_size(log_obj_size: bool) -> None:
"""
Check if log_obj_size is True and raise a ValueError if it is.
"""
if log_obj_size:
raise ValueError(
"log_obj_size is not supported for the executorlib.SlurmClusterExecutor and executorlib.FluxClusterExecutor."
"Please use log_obj_size=False instead of log_obj_size=True."
)
5 changes: 5 additions & 0 deletions tests/test_standalone_inputcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
check_hostname_localhost,
check_pysqa_config_directory,
check_file_exists,
check_log_obj_size,
validate_number_of_cores,
)

Expand Down Expand Up @@ -119,3 +120,7 @@ def test_validate_number_of_cores(self):
),
int,
)

def test_check_log_obj_size(self):
with self.assertRaises(ValueError):
check_log_obj_size(log_obj_size=True)
Loading