|
1 | 1 | import attr |
2 | | -from typing import List, Dict, Any |
| 2 | +from typing import List, Dict, Any, Optional, Callable |
3 | 3 | from mlmc.quantity.quantity_spec import QuantitySpec |
4 | 4 |
|
5 | 5 |
|
6 | 6 | @attr.s(auto_attribs=True) |
7 | 7 | class LevelSimulation: |
8 | 8 | """ |
9 | | - This class is used to pass simulation data at a given level between a Sampler and a SamplingPool |
10 | | - User shouldn't change this class |
| 9 | + Class for passing simulation configuration and metadata for a given level between |
| 10 | + a Sampler and a SamplingPool. |
| 11 | +
|
| 12 | + User shouldn't modify this class manually. |
11 | 13 | """ |
| 14 | + |
12 | 15 | config_dict: Dict[Any, Any] |
13 | | - # Calculate configuration. |
| 16 | + # Level-specific simulation configuration dictionary. |
14 | 17 |
|
15 | | - common_files: List[str] = None |
16 | | - # List of files in the level workspace to copy/symlink to the sample workspace. |
| 18 | + common_files: Optional[List[str]] = None |
| 19 | + # List of files in the level workspace to copy or symlink to the sample workspace. |
17 | 20 |
|
18 | 21 | need_sample_workspace: bool = False |
19 | | - # If the simulation needs sample workspace at all. |
| 22 | + # Whether the simulation requires an individual workspace for each sample. |
20 | 23 |
|
21 | | - task_size: int = 0 |
22 | | - # Relative size of the simulation at this level. |
23 | | - # When using PBS, keep in mind that the pbs job size is the sum of task_sizes, and if this sum is above 1, |
24 | | - # the job is scheduled and PBS scheduler manages it |
| 24 | + task_size: float = 0.0 |
| 25 | + # Relative size (or computational cost) of the simulation task at this level. |
| 26 | + # When using PBS or SLURM, note that the job size is the sum of task_sizes. |
| 27 | + # If this sum exceeds 1.0, the job is queued and scheduled by the system. |
25 | 28 |
|
26 | | - ### User shouldn't modify the following attributes ### |
27 | | - _calculate: Any = None |
28 | | - # Calculate method |
| 29 | + ### Internal attributes — users should not modify these ### |
| 30 | + _calculate: Optional[Callable] = None |
| 31 | + # Calculation method used internally by the sampler. |
29 | 32 |
|
30 | | - _level_id: int = None |
31 | | - # Level id is set by mlmc.sampler.Sampler. It is internal variable and user shouldn't change it. |
| 33 | + _level_id: Optional[int] = None |
| 34 | + # Level identifier, set automatically by mlmc.sampler.Sampler. |
32 | 35 |
|
33 | | - _result_format: List[QuantitySpec] = None |
34 | | - # Simulation result format |
| 36 | + _result_format: Optional[List[QuantitySpec]] = None |
| 37 | + # Format specification for simulation results (defined by QuantitySpec instances). |
0 commit comments