Skip to content

Commit

Permalink
add separators
Browse files Browse the repository at this point in the history
  • Loading branch information
goFrendiAsgard committed Dec 10, 2023
1 parent 7b05aa0 commit 1e9415b
Show file tree
Hide file tree
Showing 49 changed files with 1,056 additions and 781 deletions.
78 changes: 52 additions & 26 deletions docs/concepts/task/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,8 @@ __Arguments:__

- `envs` (`Env`): One or more environment variable instances to be added.

Example:
__Examples:__

```python
from zrb import Task, Env
task = Task(name='task')
Expand All @@ -308,7 +309,8 @@ __Arguments:__

- `env_files` (`EnvFile`): One or more environment file instances to be added.

Example:
__Examples:__

```python
from zrb import Task, EnvFile
task = Task()
Expand All @@ -328,7 +330,8 @@ __Arguments:__

- `inputs` (`AnyInput`): One or more input instances to be added to the input list.

Example:
__Examples:__

```python
from zrb import Task, Input
task = Task(name='task')
Expand All @@ -348,7 +351,8 @@ __Arguments:__

- `upstreams` (`TAnyTask`): One or more task instances to be added to the upstream list.

Example:
__Examples:__

```python
from zrb import Task
task = Task(name='task')
Expand All @@ -371,7 +375,8 @@ __Returns:__

`bool`: True if the task is completed, False otherwise.

Example:
__Examples:__

```python
from zrb import Task
class MyTask(Task):
Expand All @@ -395,7 +400,8 @@ __Returns:__

`TAnyTask`: A copy of the current task.

Example:
__Examples:__

```python
from zrb import Task
task = Task(name='my-task', cmd='echo hello')
Expand Down Expand Up @@ -478,7 +484,8 @@ This method allows for the addition of custom validation or condition checkers.
checkers can be used to verify certain conditions before the task execution proceeds.
Subclasses should implement this method to define task-specific checkers.

Example:
__Examples:__

```python
from zrb import Task
class MyTask(Task):
Expand All @@ -491,7 +498,8 @@ class MyTask(Task):

Injects additional `EnvFile` into the task.

Example:
__Examples:__

```python
from zrb import Task
class MyTask(Task):
Expand All @@ -504,7 +512,8 @@ class MyTask(Task):

Injects environment variables into the task.

Example:
__Examples:__

```python
from zrb import Task
class MyTask(Task):
Expand All @@ -521,7 +530,8 @@ This method is used to programmatically add input parameters to the task, allowi
dynamic customization of the task's input data. Subclasses should override this method
to define specific inputs that the task should receive.

Example:
__Examples:__

```python
from zrb import Task, Input
class MyTask(Task):
Expand All @@ -538,7 +548,8 @@ This method is used for programmatically adding upstream dependencies to the tas
Upstream tasks are those that must be completed before the current task starts.
Override this method in subclasses to specify such dependencies.

Example:
__Examples:__

```python
from zrb import Task
class MyTask(Task):
Expand All @@ -558,7 +569,8 @@ __Arguments:__

- `envs` (`Env`): One or more environment variable instances to be added.

Example:
__Examples:__

```python
from zrb import Task, Env
task = Task(name='task')
Expand All @@ -579,7 +591,8 @@ __Arguments:__

- `env_files` (`EnvFile`): One or more environment file instances to be added.

Example:
__Examples:__

```python
from zrb import Task, EnvFile
task = Task()
Expand All @@ -599,7 +612,8 @@ __Arguments:__

- `inputs` (`AnyInput`): One or more input instances to be added to the input list.

Example:
__Examples:__

```python
from zrb import Task, Input
task = Task(name='task')
Expand All @@ -620,7 +634,8 @@ __Arguments:__

- `upstreams` (`TAnyTask`): One or more task instances to be added to the upstream list.

Example:
__Examples:__

```python
from zrb import Task
task = Task(name='task')
Expand Down Expand Up @@ -667,7 +682,8 @@ __Arguments:__
- `is_last_attempt` (`bool`): Indicates if this is the final retry attempt.
- `exception` (`Exception`): The exception that caused the task to fail.

Example:
__Examples:__

```python
from zrb import Task
class MyTask(Task):
Expand All @@ -687,7 +703,8 @@ This asynchronous method should be implemented in subclasses to specify
actions that occur when the task reaches the `ready` state. This can include
any cleanup, notification, or follow-up actions specific to the task.

Example:
__Examples:__

```python
from zrb import Task
class MyTask(Task):
Expand All @@ -704,7 +721,8 @@ Implement this method to specify behavior when the task is retried after a failu
This could include resetting states, logging the retry attempt, or other necessary
steps before re-execution.

Example:
__Examples:__

```python
from zrb import Task
class MyTask(Task):
Expand All @@ -720,7 +738,8 @@ Defines actions to perform when the task status is set to `skipped`.
Implement this method to specify behavior when the task is skipped. This could
include logging information, cleaning up resources, or any other necessary steps.

Example:
__Examples:__

```python
from zrb import Task
class MyTask(Task):
Expand All @@ -736,7 +755,8 @@ Defines actions to perform when the task status is set to 'started'.
Implement this method to specify behavior when the task starts its execution. This
could involve initializing resources, logging, or other startup procedures.

Example:
__Examples:__

```python
from zrb import Task
class MyTask(Task):
Expand All @@ -753,7 +773,8 @@ Implement this method to specify behavior when the task transitions to the
`triggered` state. This could involve setting up prerequisites or sending
notifications.

Example:
__Examples:__

```python
from zrb import Task
class MyTask(Task):
Expand All @@ -770,7 +791,8 @@ Implement this method to specify behavior when the task transitions to the
`waiting` state. This state usually indicates the task is waiting for some
condition or prerequisite to be met.

Example:
__Examples:__

```python
from zrb import Task
class MyTask(Task):
Expand Down Expand Up @@ -806,7 +828,8 @@ __Arguments:__

- `result` (`Any`): The result of the task to be printed.

Example:
__Examples:__

>> from zrb import Task
>> # Example of overriding in a subclass
>> class MyTask(Task):
Expand Down Expand Up @@ -861,7 +884,8 @@ __Returns:__
`Any`: The result of the task execution, the type of which is determined by
the specific task implementation.

Example:
__Examples:__

```python
from zrb import Task
class MyTask(Task):
Expand Down Expand Up @@ -979,15 +1003,17 @@ __Returns:__

`Callable[..., Any]`: A callable representation of the task.

Example:
__Examples:__

```python
from zrb import Task
class MyTask(Task):
async def run(self, *args: Any, **kwargs: Any) -> int:
self.print_out('Doing some calculation')
return 42
````
```

```
>>>
```python
task = MyTask()
Expand Down
Loading

0 comments on commit 1e9415b

Please sign in to comment.