Skip to content

Commit b3d6367

Browse files
author
martinspetlik
committed
improved comments generated
1 parent d15e24e commit b3d6367

25 files changed

Lines changed: 3176 additions & 2517 deletions

mlmc/level_simulation.py

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,37 @@
11
import attr
2-
from typing import List, Dict, Any
2+
from typing import List, Dict, Any, Optional, Callable
33
from mlmc.quantity.quantity_spec import QuantitySpec
44

55

66
@attr.s(auto_attribs=True)
77
class LevelSimulation:
88
"""
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.
1113
"""
14+
1215
config_dict: Dict[Any, Any]
13-
# Calculate configuration.
16+
# Level-specific simulation configuration dictionary.
1417

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.
1720

1821
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.
2023

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.
2528

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.
2932

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.
3235

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

Comments
 (0)