Skip to content
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

Added tasks tutorial #1027

Merged
merged 1 commit into from
Jul 26, 2021
Merged

Added tasks tutorial #1027

merged 1 commit into from
Jul 26, 2021

Conversation

qstokkink
Copy link
Collaborator

@qstokkink qstokkink commented Jul 25, 2021

Fixes #977

This PR:

  • Adds a tutorial on task management.
  • Adds a tutorial on DiscoveryStrategy creation.

These are the basics required to take #979 off of "on hold".

@qstokkink
Copy link
Collaborator Author

validate

@qstokkink
Copy link
Collaborator Author

The remaining Flake 8 and Pylint errors are due to the documentation import system and the usage of prints. Marking this as ready.

Instead of having to compile this PR yourself, please enjoy this complementary PNG render:

taskmngr_docs

@qstokkink qstokkink marked this pull request as ready for review July 25, 2021 14:35
@qstokkink qstokkink changed the title WIP: Added tasks tutorial READY: Added tasks tutorial Jul 25, 2021

For your convenience, every ``Community`` is also a ``TaskManager``.
However, try to avoid spawning any tasks in the ``__init__`` of your ``Community``.
Specifically, you could end up scheduling a task in between your ``Community`` and other ``Community`` initialization
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sentence is missing a period.

.. literalinclude:: tasks_tutorial_6.py
:lines: 18-26

Network IO and the DiscoveryStrategy
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part feels a bit detached from the overall story which is mostly about the task manager. Maybe you could move it to a separate tutorial file?

@qstokkink qstokkink changed the title READY: Added tasks tutorial WIP: Added tasks tutorial Jul 26, 2021
@qstokkink qstokkink marked this pull request as draft July 26, 2021 07:51
@qstokkink
Copy link
Collaborator Author

validate

@qstokkink qstokkink changed the title WIP: Added tasks tutorial READY: Added tasks tutorial Jul 26, 2021
@qstokkink qstokkink requested a review from devos50 July 26, 2021 08:19
@qstokkink qstokkink marked this pull request as ready for review July 26, 2021 08:19
Comment on lines +1 to +8
Network IO and the DiscoveryStrategy
====================================

This document assumes you have a basic understanding of asyncio tasks, as documented in `the tasks tutorial <../../basics/tasks_tutorial>`_.
You will learn how to use the IPv8's ``DiscoveryStrategy`` class to avoid network congestion.

The DiscoveryStrategy
---------------------
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@devos50 These lines and the next section heading are new since your last review.

@qstokkink qstokkink changed the title READY: Added tasks tutorial Added tasks tutorial Jul 26, 2021
@qstokkink qstokkink merged commit 8f9c823 into Tribler:master Jul 26, 2021
@qstokkink qstokkink deleted the add_tasks_doc branch July 26, 2021 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Add documentation for tasks
2 participants