• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pyiron / pympipool / 9890133465

11 Jul 2024 10:52AM UTC coverage: 93.776%. Remained the same
9890133465

push

github

web-flow
Merge pull request #370 from pyiron/dependabot/pip/matplotlib-3.9.1

Bump matplotlib from 3.9.0 to 3.9.1

889 of 948 relevant lines covered (93.78%)

0.94 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

87.04
/pympipool/shared/inputcheck.py
1
import inspect
1✔
2
from concurrent.futures import Executor
1✔
3
from typing import List, Optional
1✔
4

5

6
def check_oversubscribe(oversubscribe: bool):
1✔
7
    if oversubscribe:
1✔
8
        raise ValueError(
1✔
9
            "Oversubscribing is not supported for the pympipool.flux.PyFLuxExecutor backend."
10
            "Please use oversubscribe=False instead of oversubscribe=True."
11
        )
12

13

14
def check_command_line_argument_lst(command_line_argument_lst: List[str]):
1✔
15
    if len(command_line_argument_lst) > 0:
1✔
16
        raise ValueError(
1✔
17
            "The command_line_argument_lst parameter is not supported for the SLURM backend."
18
        )
19

20

21
def check_gpus_per_worker(gpus_per_worker: int):
1✔
22
    if gpus_per_worker != 0:
1✔
23
        raise TypeError(
1✔
24
            "GPU assignment is not supported for the pympipool.mpi.PyMPIExecutor backend."
25
            "Please use gpus_per_worker=0 instead of gpus_per_worker="
26
            + str(gpus_per_worker)
27
            + "."
28
        )
29

30

31
def check_threads_per_core(threads_per_core: int):
1✔
32
    if threads_per_core != 1:
1✔
33
        raise TypeError(
1✔
34
            "Thread based parallelism is not supported for the pympipool.mpi.PyMPIExecutor backend."
35
            "Please use threads_per_core=1 instead of threads_per_core="
36
            + str(threads_per_core)
37
            + "."
38
        )
39

40

41
def check_executor(executor: Executor):
1✔
42
    if executor is not None:
1✔
43
        raise ValueError(
1✔
44
            "The executor parameter is only supported for the flux framework backend."
45
        )
46

47

48
def check_resource_dict(function: callable):
1✔
49
    if "resource_dict" in inspect.signature(function).parameters.keys():
1✔
50
        raise ValueError(
1✔
51
            "The parameter resource_dict is used internally in pympipool, "
52
            "so it cannot be used as parameter in the submitted functions."
53
        )
54

55

56
def check_resource_dict_is_empty(resource_dict: dict):
1✔
57
    if len(resource_dict) > 0:
1✔
58
        raise ValueError(
1✔
59
            "When block_allocation is enabled, the resource requirements have to be defined on the executor level."
60
        )
61

62

63
def check_refresh_rate(refresh_rate: float):
1✔
64
    if refresh_rate != 0.01:
1✔
65
        raise ValueError(
1✔
66
            "The sleep_interval parameter is only used when disable_dependencies=False."
67
        )
68

69

70
def check_plot_dependency_graph(plot_dependency_graph: bool):
1✔
71
    if plot_dependency_graph:
×
72
        raise ValueError(
×
73
            "The plot_dependency_graph parameter is only used when disable_dependencies=False."
74
        )
75

76

77
def validate_backend(
1✔
78
    backend: str, flux_installed: bool = False, slurm_installed: bool = False
79
) -> str:
80
    if backend not in ["auto", "flux", "local", "slurm"]:
1✔
81
        raise ValueError(
1✔
82
            'The currently implemented backends are ["auto", "flux", "local", "slurm"]. '
83
            'Alternatively, you can select "auto", the default option, to automatically determine the backend. But '
84
            + backend
85
            + " is not a valid choice."
86
        )
87
    elif backend == "flux" and not flux_installed:
1✔
88
        raise ImportError(
×
89
            "Flux backend is selected but not installed. Please install the flux framework."
90
        )
91
    elif backend == "slurm" and not slurm_installed:
1✔
92
        raise RuntimeError(
×
93
            "Slurm backend is selected but not installed. Please ensure SLURM is correctly configured."
94
        )
95
    elif backend == "flux" or (backend == "auto" and flux_installed):
1✔
96
        return "flux"
1✔
97
    elif backend == "slurm" or (backend == "auto" and slurm_installed):
1✔
98
        return "slurm"
×
99
    else:
100
        return "local"
1✔
101

102

103
def check_pmi(backend: str, pmi: Optional[str]):
1✔
104
    if backend != "flux" and pmi is not None:
1✔
105
        raise ValueError("The pmi parameter is currently only implemented for flux.")
×
106
    elif backend == "flux" and pmi not in ["pmix", "pmi1", "pmi2", None]:
1✔
107
        raise ValueError(
×
108
            "The pmi parameter supports [pmix, pmi1, pmi2], but not: " + pmi
109
        )
110

111

112
def check_init_function(block_allocation: bool, init_function: callable):
1✔
113
    if not block_allocation and init_function is not None:
1✔
114
        raise ValueError("")
1✔
115

116

117
def validate_number_of_cores(max_cores: int, max_workers: int) -> int:
1✔
118
    # only overwrite max_cores when it is set to 1
119
    if max_workers != 1 and max_cores == 1:
1✔
120
        return max_workers
1✔
121
    return max_cores
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc