Skip to content

Commit

Permalink
docs: updated some docstrings and removed comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Miksus committed Nov 23, 2021
1 parent fdeb937 commit e642833
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 3 deletions.
38 changes: 37 additions & 1 deletion redengine/arguments/builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,26 @@ class Return(BaseArgument):
Parameters
----------
name : str
Name of the task which return is represented.
Name of the task which return value the argument
represents.
Examples
--------
.. code-block:: python
from redengine.arguments import Return
from redengine.tasks import FuncTask
# Create a task with a return
@FuncTask()
def my_task_1():
...
return data
@FuncTask(parameters={"myarg": Return('my_task_1')})
def my_task_2(myarg):
...
"""

def __init__(self, task_name, default=None):
Expand Down Expand Up @@ -80,6 +99,23 @@ class FuncArg(BaseArgument):
Examples
--------
Simple example:
.. code-block:: python
from redengine.tasks import FuncTask
from redengine.arguments import FuncArg
def my_func():
...
return obj
@FuncTask(parameters={"my_param": FuncArg(my_func)})
def my_task(my_param):
...
Example to set to session:
.. doctest:: funcarg
>>> from redengine.arguments import FuncArg
Expand Down
4 changes: 4 additions & 0 deletions redengine/conditions/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ def is_foo(place):
... # Expensive check
return True
Using the condition:
.. code-block:: python
from redengine.tasks import FuncTask
@FuncTask(start_cond="is foo at home")
Expand Down
2 changes: 0 additions & 2 deletions redengine/core/schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,6 @@ def handle_logs(self):
del record.__return__

task.log_record(record)
# return_values = self._param_queue.get(block=False)
# self.returns[return_values[0]] = return_values[1]

def handle_zombie_tasks(self):
"""If there are tasks that has been crashed during setting up the task loggers,
Expand Down

0 comments on commit e642833

Please sign in to comment.