Repository navigation
Conversation
b2f355a to
e532ce2
Compare
e39c91e to
7e13e1b
Compare
|
|
||
|
|
||
| def get_default_samples_dir(environment=None): | ||
| """Returns the default samples directory |
There was a problem hiding this comment.
Document the environment parameter.
| @@ -946,8 +968,18 @@ class KhiopsLocalRunner(KhiopsRunner): | |||
|
|
|||
There was a problem hiding this comment.
I would document the environment in the class docstring, then the __init__ should only have "See class docstring" as its docstring (cf. AnalysisResults and other classes in khiops.core).
| def __init__(self, environment=None): | ||
| """Initialize a local runner. | ||
|
|
||
| Parameters |
There was a problem hiding this comment.
Move to the class docstring (see the comment above).
| # Ensure the previous runner is a KhiopsLocalRunner | ||
| # to avoid overwriting a mocked runner |
There was a problem hiding this comment.
Mocked runners are test-specific objects. IMHO they should not be mentioned in test code. I would just state "Ensure KHIOPS_PROC_NUMBER is set on KhiopsLocalRunner instances". And, in order to make sure we are dealing with "KhiopsLocalRunner" and not its subclasses, we could do if type(get_runner()) == KhiopsLocalRunner IMHO.
| # to avoid overwriting a mocked runner | ||
| if isinstance(get_runner(), KhiopsLocalRunner): | ||
| khiops_env = os.environ.copy() | ||
| # The max pre-allocated cpu cores must have the same value |
There was a problem hiding this comment.
Insert empty line before this comment.
| # Ensure the previous runner is a KhiopsLocalRunner | ||
| # to avoid overwriting a mocked runner | ||
| if isinstance(get_runner(), KhiopsLocalRunner): | ||
| khiops_env = os.environ.copy() |
There was a problem hiding this comment.
I would rename khiops_env to something like task_environment to avoid confusion with the khiops_env script.
| "kh_samples", "train_predictor_file_paths", "AnalysisResults.khj" | ||
| ) | ||
| # The existing MockedRunnerContext class is not used here | ||
| # as it creates a new KhiopsLocalRunner instance that does not fit our needs |
There was a problem hiding this comment.
Add comment here, like: "# Patch KhiopsLocalRunner so that Khiops is not run"
| target_variable="class", | ||
| analysis_report_file_path=report_file_path, | ||
| trace=True, | ||
| max_cores=17, |
There was a problem hiding this comment.
Set to variable, like expected_max_cores rather than hard-coding it, so that the test is more readable (as it would reuse this variable).
…value of `max_cores` - the pre-allocated number of CPU cores can never be greater than the value of `max_cores` - the KhiopsLocalRunner accepts a 'private' local environment so that the `max_cores` value is valid only for the run
7e13e1b to
20aab02
Compare
max_coresFixes #585
Implementation details :
TODO Before Asking for a Review
main(ormain-v10)Unreleasedsection ofCHANGELOG.md(no date)index.html