particula.execution.scheduler
Resolve direct-import-only, declaration-only scheduling metadata.
This concrete module validates immutable declaration graph declarations before applying enabled-node selection, direction policy, and freshness closure. Resolution is prelaunch-only: it neither loads backends nor enters lifecycle state, allocates resources, executes refreshes, or mutates caller-owned data. Its names are not package exports and must be imported from this module directly.
Attributes
| Name | Description |
|---|---|
_FRESHNESS_EDGES | No description. |
_NAME_PATTERN | No description. |
_NUCLEATION_CONDENSATION_EDGES | No description. |
_RESOLVER_SCHEDULES | No description. |
_SCHEDULE_PROVENANCE | No description. |
Classes
| Name | Description |
|---|---|
EnabledNodeSelection | Declare the complete immutable set of enabled declaration node |
NucleationCondensationDirection | Declare the reviewed nucleation/condensation ordering. |
ResolvedTimestepSchedule | Store canonical, immutable declaration-only scheduling metadata. |
SchedulerProfile | Declare immutable scheduler direction policy without selecting execution. |
Functions
| Name | Description |
|---|---|
_add_freshness_pairs | Add freshness edges only when both endpoints are selected. |
_direction_edge | Return the declared direction as one graph edge. |
_raise_unsatisfied_closure | Raise the stable error for a missing required predecessor. |
_resolve_effective_pairs | Combine retained declarations, profile policy, and freshness closure. |
_retained_pairs | Return selected declaration edges after enforcing explicit dependency |
_validate_profile_direction | Reject an explicit declaration direction that opposes the profile. |
_validate_resolution_inputs | Validate public scheduler carriers before declaration resolution. |
_validate_schedule_content | Validate canonical schedule ordering, endpoints, and permutation. |
_validate_schedule_types | Validate exact immutable schedule container and member types. |
_validate_selected_ids | Reject selected IDs that are absent from an already resolved declaration |
is_resolver_produced_schedule | Return whether a schedule retains its exact resolver-produced graph. |
resolve_timestep_schedule | Resolve an immutable effective schedule without running any process. |
_FRESHNESS_EDGESattributemodule attribute#
_FRESHNESS_EDGES = (
('environment_update', 'vapor_pressure_refresh'),
('environment_update', 'saturation_refresh'),
('gas_update', 'saturation_refresh'),
('environment_update', 'brownian_coagulation'),
('environment_update', 'wall_loss'),
('environment_update', 'nucleation'),
('gas_update', 'condensation'),
('gas_update', 'dilution'),
('gas_update', 'nucleation'),
('vapor_pressure_refresh', 'saturation_refresh'),
('saturation_refresh', 'condensation'),
('saturation_refresh', 'diagnostics')
)_NAME_PATTERNattributemodule attribute#
_NAME_PATTERN = re.compile('^[a-z][a-z0-9_]*$')_NUCLEATION_CONDENSATION_EDGESattributemodule attribute#
_NUCLEATION_CONDENSATION_EDGES = frozenset({('nucleation', 'condensation'), ('condensation', 'nucleation')})_RESOLVER_SCHEDULESattributemodule attribute#
_RESOLVER_SCHEDULES: list[object] = []_SCHEDULE_PROVENANCEattributemodule attribute#
_SCHEDULE_PROVENANCE = object()EnabledNodeSelectionclassdataclass#
class EnabledNodeSelection(enabled_node_ids: frozenset[str])Declare the complete immutable set of enabled declaration node identifiers.
Graph membership is deliberately deferred to schedule resolution, after complete declaration plan validation.
Parameters
| Name | Type | Description |
|---|---|---|
enabled_node_ids | frozenset[str] | Exact frozenset of syntactically valid node IDs. |
enabled_node_idsattributeinstance attribute#
enabled_node_ids: frozenset[str]NucleationCondensationDirectionclass#
class NucleationCondensationDirection(str, Enum)Bases: str, Enum
Declare the reviewed nucleation/condensation ordering.
ResolvedTimestepScheduleclassdataclass#
class ResolvedTimestepSchedule(nodes: tuple[ProcessNode, ...], dependencies: tuple[DependencyEdge, ...], ordered_node_ids: tuple[str, ...], source_graph: ResolvedProcessGraph | None = None, _provenance: object | None = None)Store canonical, immutable declaration-only scheduling metadata.
Nodes and dependencies are canonically sorted. The order is a permutation of node IDs created before any lifecycle entry, resource action, or process launch.
Parameters
| Name | Type | Description |
|---|---|---|
nodes | tuple[ProcessNode, ...] | Sorted exact tuple of enabled process nodes. |
dependencies | tuple[DependencyEdge, ...] | Sorted exact tuple of effective dependency edges. |
ordered_node_ids | tuple[str, ...] | Canonical dependency order for exactly these nodes. |
_provenanceattributeclass attributeinstance attribute#
_provenance: object | None = field(default=None, repr=False, compare=False)dependenciesattributeinstance attribute#
dependencies: tuple[DependencyEdge, ...]nodesattributeinstance attribute#
nodes: tuple[ProcessNode, ...]ordered_node_idsattributeinstance attribute#
ordered_node_ids: tuple[str, ...]source_graphattributeclass attributeinstance attribute#
source_graph: ResolvedProcessGraph | None = field(default=None, repr=False, compare=False)__init__method#
def __init__(nodes: tuple[ProcessNode, ...], dependencies: tuple[DependencyEdge, ...], ordered_node_ids: tuple[str, ...], source_graph: ResolvedProcessGraph | None = None, _provenance: object | None = None) -> None__post_init__method#
def __post_init__() -> NoneValidate canonical immutable schedule fields.
SchedulerProfileclassdataclass#
class SchedulerProfile(nucleation_condensation_direction: NucleationCondensationDirection)Declare immutable scheduler direction policy without selecting execution.
The enum represents exactly one reviewed nucleation/condensation direction; it cannot encode both directions or no direction.
Parameters
| Name | Type | Description |
|---|---|---|
nucleation_condensation_direction | NucleationCondensationDirection | The one permitted direction policy. |
nucleation_condensation_directionattributeinstance attribute#
nucleation_condensation_direction: NucleationCondensationDirection__init__method#
def __init__(nucleation_condensation_direction: NucleationCondensationDirection) -> None__post_init__method#
def __post_init__() -> NoneValidate the single direction declaration.
_add_freshness_pairsfunction#
def _add_freshness_pairs(pairs: set[tuple[str, str]], enabled: frozenset[str]) -> NoneAdd freshness edges only when both endpoints are selected.
_direction_edgefunction#
def _direction_edge(profile: SchedulerProfile) -> tuple[str, str]Return the declared direction as one graph edge.
_raise_unsatisfied_closurefunction#
def _raise_unsatisfied_closure(before_id: str, after_id: str) -> NoneRaise the stable error for a missing required predecessor.
_resolve_effective_pairsfunction#
def _resolve_effective_pairs(resolved: ResolvedProcessGraph, selection: EnabledNodeSelection, profile: SchedulerProfile, direction: tuple[str, str]) -> set[tuple[str, str]]Combine retained declarations, profile policy, and freshness closure.
_retained_pairsfunction#
def _retained_pairs(resolved: ResolvedProcessGraph, enabled: frozenset[str]) -> set[tuple[str, str]]Return selected declaration edges after enforcing explicit dependency closure.
_validate_profile_directionfunction#
def _validate_profile_direction(resolved: ResolvedProcessGraph, direction: tuple[str, str]) -> NoneReject an explicit declaration direction that opposes the profile.
_validate_resolution_inputsfunction#
def _validate_resolution_inputs(plan: object, selection: object, profile: object) -> NoneValidate public scheduler carriers before declaration resolution.
_validate_schedule_contentfunction#
def _validate_schedule_content(schedule: ResolvedTimestepSchedule) -> NoneValidate canonical schedule ordering, endpoints, and permutation.
_validate_schedule_typesfunction#
def _validate_schedule_types(schedule: ResolvedTimestepSchedule) -> NoneValidate exact immutable schedule container and member types.
_validate_selected_idsfunction#
def _validate_selected_ids(selection: EnabledNodeSelection, resolved: ResolvedProcessGraph) -> NoneReject selected IDs that are absent from an already resolved declaration graph.
is_resolver_produced_schedulefunction#
def is_resolver_produced_schedule(schedule: ResolvedTimestepSchedule, graph: ResolvedProcessGraph) -> boolReturn whether a schedule retains its exact resolver-produced graph.
This internal provenance check prevents a structurally similar hand-built schedule from entering the resident execution boundary.
resolve_timestep_schedulefunction#
def resolve_timestep_schedule(plan: TimestepPlan, selection: EnabledNodeSelection, profile: SchedulerProfile) -> ResolvedTimestepScheduleResolve an immutable effective schedule without running any process.
After exact carrier-type checks, complete declaration graph validation happens before selection or profile inspection. This function then applies selected IDs, direction policy, required freshness closure, and canonical topology ordering. It returns metadata only and performs no lifecycle, resource, or GPU work.
Parameters
| Name | Type | Description |
|---|---|---|
plan | TimestepPlan | Exact declaration plan declaration. |
selection | EnabledNodeSelection | Exact enabled-node selection. |
profile | SchedulerProfile | Exact immutable direction policy. |
Returns
ResolvedTimestepSchedule- A new canonical schedule with no disabled dependency endpoints.
Raises
TypeError- If a carrier is not its exact declared type.
ValueError- If selection, direction, closure, or effective topology is invalid. No input is mutated when resolution fails; no rollback is required because resolution has no side effects.