Skip to content

Remove pytask_execute_create_scheduler hook. #575

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/source/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ releases are available on [PyPI](https://pypi.org/project/pytask) and
- {pull}`569` removes the hooks related to the creation of the DAG.
- {pull}`571` removes redundant calls to `PNode.state()` which causes a high penalty for
remote files.
- {pull}`573` removes the `pytask_execute_create_scheduler` hook.

## 0.4.5 - 2024-01-09

Expand Down
1 change: 0 additions & 1 deletion docs/source/reference_guides/hookspecs.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ The following hooks execute the tasks and log information on the result in the t
```{eval-rst}
.. autofunction:: pytask_execute
.. autofunction:: pytask_execute_log_start
.. autofunction:: pytask_execute_create_scheduler
.. autofunction:: pytask_execute_build
.. autofunction:: pytask_execute_task_protocol
.. autofunction:: pytask_execute_task_log_start
Expand Down
8 changes: 1 addition & 7 deletions src/_pytask/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def pytask_post_parse(config: dict[str, Any]) -> None:
def pytask_execute(session: Session) -> None:
"""Execute tasks."""
session.hook.pytask_execute_log_start(session=session)
session.scheduler = session.hook.pytask_execute_create_scheduler(session=session)
session.scheduler = TopologicalSorter.from_dag(session.dag)
session.hook.pytask_execute_build(session=session)
session.hook.pytask_execute_log_end(
session=session, reports=session.execution_reports
Expand All @@ -73,12 +73,6 @@ def pytask_execute_log_start(session: Session) -> None:
console.print()


@hookimpl(trylast=True)
def pytask_execute_create_scheduler(session: Session) -> TopologicalSorter:
"""Create a scheduler based on topological sorting."""
return TopologicalSorter.from_dag(session.dag)


@hookimpl
def pytask_execute_build(session: Session) -> bool | None:
"""Execute tasks."""
Expand Down
10 changes: 0 additions & 10 deletions src/_pytask/hookspecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,16 +232,6 @@ def pytask_execute_log_start(session: Session) -> None:
"""


@hookspec(firstresult=True)
def pytask_execute_create_scheduler(session: Session) -> Any:
"""Create a scheduler for the execution.

The scheduler provides information on which tasks are able to be executed. Its
foundation is likely a topological ordering of the tasks based on the DAG.

"""


@hookspec(firstresult=True)
def pytask_execute_build(session: Session) -> Any:
"""Execute the build.
Expand Down