Skip to content

Commit 94f0aff

Browse files
authored
Merge pull request #295 from ExaWorks/fix-path-type
ensure that workdir is converted to `Path` type
2 parents ab838cf + ca2e614 commit 94f0aff

File tree

2 files changed

+44
-4
lines changed

2 files changed

+44
-4
lines changed

src/psij/job_executor_config.py

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from pathlib import Path
2-
from typing import Optional
2+
from typing import Optional, Union
33

44

55
class JobExecutorConfig(object):
@@ -25,11 +25,49 @@ def __init__(self, launcher_log_file: Optional[Path] = None,
2525
that the exit code file, likely written on a service node, can be accessed by PSI/J,
2626
likely running on a head node.
2727
"""
28-
self.launcher_log_file = launcher_log_file
28+
self._launcher_log_file = launcher_log_file
29+
2930
if work_directory:
30-
self.work_directory = work_directory
31+
self._work_directory = work_directory
3132
else:
32-
self.work_directory = JobExecutorConfig.DEFAULT_WORK_DIRECTORY
33+
self._work_directory = JobExecutorConfig.DEFAULT_WORK_DIRECTORY
34+
35+
@property
36+
def launcher_log_file(self) -> Optional[Path]:
37+
"""
38+
Configure the executor's launcher log file.
39+
40+
Parameters
41+
----------
42+
launcher_log_file
43+
If specified, log messages from launcher scripts (including
44+
output from pre- and post- launch scripts) will be directed to this file.
45+
"""
46+
return self._launcher_log_file
47+
48+
@launcher_log_file.setter
49+
def launcher_log_file(self, value: Optional[Union[str, Path]]) -> None:
50+
if value:
51+
self._launcher_log_file = Path(value)
52+
53+
@property
54+
def work_directory(self) -> Path:
55+
"""
56+
Configure the execor's work directory.
57+
58+
Parameters
59+
----------
60+
work_directory
61+
A directory where submit scripts and auxiliary job files will be generated. In a,
62+
cluster this directory needs to point to a directory on a shared filesystem. This is so
63+
that the exit code file, likely written on a service node, can be accessed by PSI/J,
64+
likely running on a head node.
65+
"""
66+
return self._work_directory
67+
68+
@work_directory.setter
69+
def work_directory(self, value: Union[str, Path]) -> None:
70+
self._work_directory = Path(value)
3371

3472

3573
JobExecutorConfig.DEFAULT = JobExecutorConfig()

tests/plugins1/_batch_test/_batch_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ def __init__(self, launcher_log_file: Optional[Path] = None,
2828
super().__init__(launcher_log_file, work_directory, queue_polling_interval,
2929
initial_queue_polling_delay, queue_polling_error_threshold, keep_files)
3030

31+
assert isinstance(self.work_directory, Path)
32+
3133

3234
class _TestJobExecutor(BatchSchedulerExecutor):
3335
_STATE_MAP = {

0 commit comments

Comments
 (0)