Skip to content

Commit 7359fcb

Browse files
committed
REFACT: compilation.py (& term) --> planning.py
1 parent ab12e04 commit 7359fcb

File tree

13 files changed

+34
-34
lines changed

13 files changed

+34
-34
lines changed

docs/source/arch.rst

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Architecture
1515
The definition & execution of networked operation is split in 1+2 phases:
1616

1717
- `composition`
18-
- `compilation`
18+
- `planning`
1919
- `execution`
2020

2121
... it is constrained by these IO data-structures:
@@ -38,7 +38,7 @@ Architecture
3838

3939
graphtik.op.FunctionalOperation
4040
graphtik.pipeline.Pipeline
41-
graphtik.network.Network
41+
graphtik.planning.Network
4242
graphtik.execution.ExecutionPlan
4343
graphtik.execution.Solution
4444

@@ -90,7 +90,7 @@ Architecture
9090
:ref:`hierarchical-data` (example).
9191

9292
compile
93-
compilation
93+
planning
9494
The `phase` where the :class:`.Network` creates a new `execution plan`
9595
by `pruning` all `graph` nodes into a subgraph `dag`, and deriving
9696
the `execution steps`.
@@ -116,7 +116,7 @@ Architecture
116116
During `composition`, the nodes of the graph are connected by repeated calls
117117
of :meth:`.Network._append_operation()` within ``Network`` constructor.
118118

119-
During `compilation` the *graph* is `prune`\d based on the given `inputs`,
119+
During `planning` the *graph* is `prune`\d based on the given `inputs`,
120120
`outputs` & `node predicate` to extract the `dag`, and it is ordered,
121121
to derive the `execution steps`, stored in a new `plan`, which is then
122122
cached on the ``Network`` class.
@@ -178,15 +178,15 @@ Architecture
178178

179179
prune
180180
pruning
181-
A subphase of `compilation` performed by method :meth:`.Network._prune_graph()`,
181+
A subphase of `planning` performed by method :meth:`.Network._prune_graph()`,
182182
which extracts a subgraph `dag` that does not contain any `unsatisfied operation`\s.
183183

184184
It topologically sorts the `graph`, and *prunes* based on given `inputs`,
185185
asked `outputs`, `node predicate` and `operation` `needs` & `provides`.
186186

187187
unsatisfied operation
188188
The core of `pruning` & `rescheduling`, performed by
189-
:func:`.network.unsatisfied_operations()` function, which collects
189+
:func:`.planning.unsatisfied_operations()` function, which collects
190190
all `operation`\s with unreachable `dependencies <dependency>`:
191191

192192
- they have `needs` that do not correspond to any of the given `inputs` or
@@ -220,7 +220,7 @@ Architecture
220220
A memory footprint optimization where intermediate `inputs` & `outputs`
221221
are erased from `solution` as soon as they are not needed further down the `dag`.
222222

223-
*Evictions* are pre-calculated during `compilation`, denoted with the
223+
*Evictions* are pre-calculated during `planning`, denoted with the
224224
`dependency` inserted in the `steps` of the `execution plan`.
225225

226226
inputs
@@ -273,7 +273,7 @@ Architecture
273273
*Operations* are then interlinked together, by matching the *needs* & *provides*
274274
of all *operations* contained in a `pipeline`.
275275

276-
- During `compilation` the `graph` is then `prune`\d based on the :term:`reachability
276+
- During `planning` the `graph` is then `prune`\d based on the :term:`reachability
277277
<unsatisfied operation>` of the *dependencies*.
278278

279279
- During `execution` :meth:`.Operation.compute()` performs 2 "matchings":
@@ -345,7 +345,7 @@ Architecture
345345

346346
modifier
347347
diacritic
348-
A `modifier` change `dependency` behavior during `compilation` or `execution`.
348+
A `modifier` change `dependency` behavior during `planning` or `execution`.
349349

350350
For instance, a `needs` may be annotated as :func:`.keyword` and/or `optionals`
351351
function arguments, `provides` and *needs* can be annotated as "ghost" `sideffects`
@@ -403,7 +403,7 @@ Architecture
403403
denoting modifications on a *real* dependency read from and written to
404404
the solution.
405405

406-
Both kinds of sideffects participate in the `compilation` of the graph,
406+
Both kinds of sideffects participate in the `planning` of the graph,
407407
and both may be given or asked in the `inputs` & `outputs` of a `pipeline`,
408408
but they are never given to functions.
409409
A function of a `returns dictionary` operation can return a falsy value
@@ -517,14 +517,14 @@ Architecture
517517
predicate
518518
node predicate
519519
A callable(op, node-data) that should return true for nodes to be
520-
included in `graph` during `compilation`.
520+
included in `graph` during `planning`.
521521

522522
abort run
523523
A global `configurations` flag that when set with :func:`.abort_run()` function,
524524
it halts the execution of all currently or future `plan`\s.
525525

526526
It is reset automatically on every call of :meth:`.Pipeline.compute()`
527-
(after a successful intermediate :term:`compilation`), or manually,
527+
(after a successful intermediate :term:`planning`), or manually,
528528
by calling :func:`.reset_abort()`.
529529

530530
parallel

docs/source/plotting.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ deeply nested stacks is notoriously hard
496496
Logging
497497
^^^^^^^
498498
Increase the logging verbosity; logging statements have been placed melticulously
499-
to describe the :term:`execution` flows (but not :term:`compilation` :-(),
499+
to describe the :term:`execution` flows (but not :term:`planning` :-(),
500500
with each log statement accompanied by the :attr:`solution id <.Solution.solid>` of that flow,
501501
like the ``(3C40)`` & ``(8697)`` below, important for when running pipelines
502502
in :term:`parallel`::

docs/source/reference.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ API Reference
88
graphtik.op
99
graphtik.pipeline
1010
graphtik.modifier
11-
graphtik.network
11+
graphtik.planning
1212
graphtik.execution
1313
graphtik.plot
1414
graphtik.config
@@ -44,10 +44,10 @@ Module: `modifier`
4444
:private-members:
4545
:special-members:
4646

47-
Module: `network`
48-
=================
47+
Module: `planning`
48+
==================
4949

50-
.. automodule:: graphtik.network
50+
.. automodule:: graphtik.planning
5151
:members:
5252
:private-members:
5353
:special-members:

graphtik/base.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ class PlotArgs(NamedTuple):
421421
#: the list of output names .
422422
outputs: Collection = None
423423
#: Contains the computed results, which might be different from :attr:`plottable`.
424-
solution: "graphtik.network.Solution" = None
424+
solution: "graphtik.planning.Solution" = None
425425
#: Either a mapping of node-names to dot(``.``)-separated cluster-names, or
426426
#: false/true to enable :term:`plotter`'s default clustering of nodes based
427427
#: on their dot-separated name parts.
@@ -514,7 +514,7 @@ def plot(
514514
steps=None,
515515
inputs=None,
516516
outputs=None,
517-
solution: "graphtik.network.Solution" = None,
517+
solution: "graphtik.planning.Solution" = None,
518518
clusters: Mapping = None,
519519
jupyter_render: Union[None, Mapping, str] = None,
520520
) -> "pydot.Dot":
@@ -794,14 +794,14 @@ def prepare_plot_args(self, plot_args: PlotArgs) -> PlotArgs:
794794
@property
795795
def ops(self) -> List["Operation"]:
796796
"""A new list with all :term:`operation`\\s contained in the :term:`network`."""
797-
from .network import yield_ops
797+
from .planning import yield_ops
798798

799799
return list(yield_ops(self.graph))
800800

801801
@property
802802
def data(self) -> List[str]:
803803
"""A new list with all :term:`operation`\\s contained in the :term:`network`."""
804-
from .network import yield_datanodes
804+
from .planning import yield_datanodes
805805

806806
return list(yield_datanodes(self.graph))
807807

graphtik/execution.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
get_jsonp,
4949
is_sfx,
5050
)
51-
from .network import (
51+
from .planning import (
5252
unsatisfied_operations,
5353
yield_chaindocs,
5454
yield_node_names,
@@ -432,7 +432,7 @@ class ExecutionPlan(
432432
"""
433433
A pre-compiled list of operation steps that can :term:`execute` for the given inputs/outputs.
434434
435-
It is the result of the network's :term:`compilation` phase.
435+
It is the result of the network's :term:`planning` phase.
436436
437437
Note the execution plan's attributes are on purpose immutable tuples.
438438

graphtik/modifier.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright 2016, Yahoo Inc.
22
# Licensed under the terms of the Apache License, Version 2.0. See the LICENSE file associated with the project for terms.
33
"""
4-
:term:`modifier`\\s change :term:`dependency` behavior during :term:`compilation` & :term:`execution`.
4+
:term:`modifier`\\s change :term:`dependency` behavior during :term:`planning` & :term:`execution`.
55
66
The `needs` and `provides` annotated with *modifiers* designate, for instance,
77
:term:`optional <optionals>` function arguments, or "ghost" :term:`sideffects`.
@@ -783,7 +783,7 @@ def sfx(name, optional: bool = None) -> _Modifier:
783783
:term:`sideffects` denoting modifications beyond the scope of the solution.
784784
785785
Both `needs` & `provides` may be designated as *sideffects* using this modifier.
786-
They work as usual while solving the graph (:term:`compilation`) but
786+
They work as usual while solving the graph (:term:`planning`) but
787787
they have a limited interaction with the operation's underlying function;
788788
specifically:
789789

graphtik/pipeline.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def parent_wrapper(ren_args: RenArgs) -> str:
122122

123123
assert all(bool(n) for n in merge_set)
124124

125-
from .network import Network # Imported here not to affect locals() at the top.
125+
from .planning import Network # Imported here not to affect locals() at the top.
126126

127127
return Network(*merge_set)
128128

@@ -370,7 +370,7 @@ def compute(
370370
Compile a plan & :term:`execute` the graph, sequentially or parallel.
371371
372372
.. Attention::
373-
If intermediate :term:`compilation` is successful, the "global
373+
If intermediate :term:`planning` is successful, the "global
374374
:term:`abort run` flag is reset before the :term:`execution` starts.
375375
376376
:param named_inputs:

graphtik/network.py renamed to graphtik/planning.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ def __init__(self, *operations, graph=None):
309309
raise TypeError(f"Must be a NetworkX graph, was: {graph}")
310310

311311
#: The :mod:`networkx` (Di)Graph containing all operations and dependencies,
312-
#: prior to :term:`compilation`.
312+
#: prior to :term:`planning`.
313313
self.graph = graph
314314

315315
for op in operations:

test/test_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import pytest
1010

11-
from graphtik import base, network, operation, pipeline
11+
from graphtik import base, planning, operation, pipeline
1212
from graphtik.execution import ExecutionPlan, Solution, _OpTask
1313
from graphtik.base import Operation
1414
from graphtik.pipeline import Pipeline

test/test_graphtik.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import pytest
99

10-
from graphtik import NO_RESULT, compose, network, operation, optional, vararg
10+
from graphtik import NO_RESULT, compose, planning, operation, optional, vararg
1111
from graphtik.base import IncompleteExecutionError
1212
from graphtik.config import evictions_skipped, operations_endured
1313

0 commit comments

Comments
 (0)