Skip to content

Commit eacecf4

Browse files
committed
Change.
1 parent ef42e6e commit eacecf4

14 files changed

+27
-26
lines changed

docs/source/changes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ releases are available on [PyPI](https://pypi.org/project/pytask) and
6262
- {pull}`485` adds missing steps to unconfigure pytask after the job is done, which
6363
caused flaky tests.
6464
- {pull}`486` adds default names to {class}`~pytask.PPathNode`.
65-
- {pull}`487` implements delayed tasks and nodes.
65+
- {pull}`487` implements task generators and provisional nodes.
6666
- {pull}`488` raises an error when an invalid value is used in a return annotation.
6767
- {pull}`489` and {pull}`491` simplifies parsing products and does not raise an error
6868
when a product annotation is used with the argument name `produces`. And allow

docs/source/how_to_guides/provisional_nodes_and_task_generators.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The following sections will explain how you use pytask in these situations.
2121
Let us start with a task that downloads all files without an extension from the root
2222
folder of the pytask repository and stores them on disk in a folder called `downloads`.
2323

24-
```{literalinclude} ../../../docs_src/how_to_guides/delayed_tasks_delayed_products.py
24+
```{literalinclude} ../../../docs_src/how_to_guides/provisional_products.py
2525
---
2626
emphasize-lines: 4, 11
2727
---
@@ -49,21 +49,21 @@ actual nodes. A {class}`~pytask.DirectoryNode`, for example, returns
4949
In the next step, we want to define a task that consumes and merges all previously
5050
downloaded files into one file.
5151

52-
```{literalinclude} ../../../docs_src/how_to_guides/delayed_tasks_delayed_task.py
52+
```{literalinclude} ../../../docs_src/how_to_guides/provisional_task.py
5353
---
5454
emphasize-lines: 9
5555
---
5656
```
5757

58-
Here, we use the {class}`~pytask.DirectoryNode` as a dependency since we do not know the
58+
Here, the {class}`~pytask.DirectoryNode` is a dependency because we do not know the
5959
names of the downloaded files. Before the task is executed, the list of files in the
6060
folder defined by the root path and the pattern are automatically collected and passed
6161
to the task.
6262

63-
If we use a {class}`DirectoryNode` with the same `root_dir` and `pattern` in both tasks,
64-
pytask will automatically recognize that the second task depends on the first. If that
65-
is not true, you might need to make this dependency more explicit by using
66-
{func}`@task(after=...) <pytask.task>`, which is explained {ref}`here <after>`.
63+
If we use a {class}`~pytask.DirectoryNode` with the same `root_dir` and `pattern` in
64+
both tasks, pytask will automatically recognize that the second task depends on the
65+
first. If that is not true, you might need to make this dependency more explicit by
66+
using {func}`@task(after=...) <pytask.task>`, which is explained {ref}`here <after>`.
6767

6868
## Task generators
6969

@@ -79,9 +79,10 @@ writing functions in a task module.
7979
The code snippet shows each task takes one of the downloaded files and copies its
8080
content to a `.txt` file.
8181

82-
```{literalinclude} ../../../docs_src/how_to_guides/delayed_tasks_task_generator.py
82+
```{literalinclude} ../../../docs_src/how_to_guides/provisional_task_generator.py
8383
```
8484

8585
```{important}
86-
The generated tasks need to be decoratored with {func}`@task <pytask.task>` to be collected.
86+
The generated tasks need to be decoratored with {func}`@task <pytask.task>` to be
87+
collected.
8788
```

src/_pytask/execute.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
from _pytask.dag_utils import node_and_neighbors
2323
from _pytask.database_utils import has_node_changed
2424
from _pytask.database_utils import update_states_in_database
25-
from _pytask.delayed_utils import collect_provisional_products
2625
from _pytask.exceptions import ExecutionError
2726
from _pytask.exceptions import NodeLoadError
2827
from _pytask.exceptions import NodeNotFoundError
@@ -38,6 +37,7 @@
3837
from _pytask.outcomes import WouldBeExecuted
3938
from _pytask.outcomes import count_outcomes
4039
from _pytask.pluginmanager import hookimpl
40+
from _pytask.provisional_utils import collect_provisional_products
4141
from _pytask.reports import ExecutionReport
4242
from _pytask.traceback import remove_traceback_from_exc_info
4343
from _pytask.tree_util import tree_leaves

src/_pytask/node_protocols.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def load(self, is_product: bool = False) -> Any: # pragma: no cover
129129
130130
It is possible to load a provisional node as a dependency so that it can inject
131131
basic information about it in the task. For example,
132-
:meth:`pytask.DirectoryNode` injects the root directory.
132+
:meth:`pytask.DirectoryNode.load` injects the root directory.
133133
134134
"""
135135
if is_product:

src/_pytask/persist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
from _pytask.dag_utils import node_and_neighbors
99
from _pytask.database_utils import has_node_changed
1010
from _pytask.database_utils import update_states_in_database
11-
from _pytask.delayed_utils import collect_provisional_products
1211
from _pytask.mark_utils import has_mark
1312
from _pytask.outcomes import Persisted
1413
from _pytask.outcomes import TaskOutcome
1514
from _pytask.pluginmanager import hookimpl
15+
from _pytask.provisional_utils import collect_provisional_products
1616

1717
if TYPE_CHECKING:
1818
from _pytask.node_protocols import PTask

src/_pytask/pluginmanager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def pytask_add_hooks(pm: PluginManager) -> None:
4646
"_pytask.dag_command",
4747
"_pytask.database",
4848
"_pytask.debugging",
49-
"_pytask.delayed",
49+
"_pytask.provisional",
5050
"_pytask.execute",
5151
"_pytask.live",
5252
"_pytask.logging",

src/_pytask/delayed.py renamed to src/_pytask/provisional.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
from pytask import TaskOutcome
1313

1414
from _pytask.config import hookimpl
15-
from _pytask.delayed_utils import TASKS_WITH_PROVISIONAL_NODES
16-
from _pytask.delayed_utils import collect_provisional_nodes
17-
from _pytask.delayed_utils import recreate_dag
1815
from _pytask.exceptions import NodeLoadError
1916
from _pytask.node_protocols import PNode
2017
from _pytask.node_protocols import PProvisionalNode
2118
from _pytask.node_protocols import PTask
2219
from _pytask.node_protocols import PTaskWithPath
2320
from _pytask.outcomes import CollectionOutcome
21+
from _pytask.provisional_utils import TASKS_WITH_PROVISIONAL_NODES
22+
from _pytask.provisional_utils import collect_provisional_nodes
23+
from _pytask.provisional_utils import recreate_dag
2424
from _pytask.reports import ExecutionReport
2525
from _pytask.task_utils import COLLECTED_TASKS
2626
from _pytask.task_utils import parse_collected_tasks_with_task_marker

0 commit comments

Comments
 (0)