Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ cython_debug/


# Dotflow
.output
*.output
.storage
.dotflow-io
*.json
Expand Down
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ def my_task_y():

workflow = DotFlow()

workflow.task.add(step=my_task_x, callback=my_callback)
workflow.task.add(step=my_task_y, callback=my_callback)
workflow.add(step=my_task_x, callback=my_callback)
workflow.add(step=my_task_y, callback=my_callback)

workflow.start()
```
Expand Down Expand Up @@ -153,20 +153,20 @@ Now, simply add the `my_task_x` and `my_callback` functions you created earlier
- Adding one step at a time:

```python
workflow.task.add(step=my_task_x, callback=my_callback)
workflow.task.add(step=my_task_y, callback=my_callback)
workflow.add(step=my_task_x, callback=my_callback)
workflow.add(step=my_task_y, callback=my_callback)
```

- Adding multiple steps at the same time:

```python
workflow.task.add(step=[my_task_x, my_task_y], callback=my_callback)
workflow.add(step=[my_task_x, my_task_y], callback=my_callback)
```

- Adding a step with the module path:

```python
workflow.task.add(step="module.task.my_task_x", callback=my_callback)
workflow.add(step="module.task.my_task_x", callback=my_callback)
```

#### 6. Start
Expand Down Expand Up @@ -216,8 +216,8 @@ dotflow start --step examples.cli_with_mode.simple_step --mode parallel
#### Sequential

```python
workflow.task.add(step=task_foo)
workflow.task.add(step=task_bar)
workflow.add(step=task_foo)
workflow.add(step=task_bar)

workflow.start()
```
Expand All @@ -237,8 +237,8 @@ D[Finish]
#### Background

```python
workflow.task.add(step=task_foo)
workflow.task.add(step=task_bar)
workflow.add(step=task_foo)
workflow.add(step=task_bar)

workflow.start(mode="background")
```
Expand All @@ -259,10 +259,10 @@ D[Finish]
#### Parallel

```python
workflow.task.add(step=task_a)
workflow.task.add(step=task_b)
workflow.task.add(step=task_c)
workflow.task.add(step=task_d)
workflow.add(step=task_a)
workflow.add(step=task_b)
workflow.add(step=task_c)
workflow.add(step=task_d)

workflow.start(mode="parallel")
```
Expand Down
6 changes: 3 additions & 3 deletions docs/nav/advanced/notify-with-telegram.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import os

from dotflow import Config, DotFlow, action
from dotflow.notify import NotifyTelegram
from dotflow.types import TypeStatus
from dotflow.types import StatusTaskType
```

### Task function
Expand All @@ -69,7 +69,7 @@ Instantiate the `NotifyTelegram` class with your Telegram bot credentials. You c
notify = NotifyTelegram(
token=os.getenv("TOKEN"),
chat_id=os.getenv("CHAT_ID"),
notification_type=TypeStatus.FAILED # Notify only on failure
notification_type=StatusTaskType.FAILED # Notify only on failure
)
```

Expand All @@ -88,7 +88,7 @@ workflow = DotFlow(
Add your defined task as a step in the workflow:

```python
workflow.task.add(step=simple_task)
workflow.add(step=simple_task)
```

### Start
Expand Down
3 changes: 0 additions & 3 deletions docs/nav/reference/abc-log.md

This file was deleted.

3 changes: 3 additions & 0 deletions docs/nav/reference/abc-logs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Logs

::: dotflow.abc.logs.Logs
3 changes: 0 additions & 3 deletions docs/nav/reference/log-default.md

This file was deleted.

3 changes: 3 additions & 0 deletions docs/nav/reference/logs-handler.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# LogsHandler

::: dotflow.plugins.logs.LogsHandler
2 changes: 1 addition & 1 deletion docs/nav/reference/notify-default.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# NotifyTelegram
# Notify Default

::: dotflow.providers.notify_default.NotifyDefault
4 changes: 2 additions & 2 deletions docs/nav/reference/type-execution.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# TypeExecution
# ExecutionModeType

::: dotflow.core.types.execution.TypeExecution
::: dotflow.core.types.execution.ExecutionModeType
options:
members:
- SEQUENTIAL
Expand Down
4 changes: 2 additions & 2 deletions docs/nav/reference/type-status.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# TypeStatus
# StatusTaskType

::: dotflow.core.types.status.TypeStatus
::: dotflow.core.types.status.StatusTaskType
options:
members:
- NOT_STARTED
Expand Down
6 changes: 3 additions & 3 deletions docs_src/backoff/backoff.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ def run(self):
def main():
workflow = DotFlow()

workflow.task.add(step=simple_step)
workflow.add(step=simple_step)
workflow.start()
workflow.task.clear()

workflow.task.add(step=SimpleStepX)
workflow.add(step=SimpleStepX)
workflow.start()
workflow.task.clear()

workflow.task.add(step=SimpleStepY)
workflow.add(step=SimpleStepY)
workflow.start()
workflow.task.clear()

Expand Down
10 changes: 5 additions & 5 deletions docs_src/callback/task_callback.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
from dotflow import DotFlow, action, Task
from dotflow.core.types.status import TypeStatus
from dotflow.core.types.status import StatusTaskType


def callback_one(task: Task):
assert task.status is TypeStatus.COMPLETED
assert task.status is StatusTaskType.COMPLETED
print(task.task_id, task.status, task.current_context.storage)


def callback_two(task: Task):
assert task.status is TypeStatus.FAILED
assert task.status is StatusTaskType.FAILED
print(task.task_id, task.status, task.current_context.storage)


Expand All @@ -25,8 +25,8 @@ def simple_two():
def main():
workflow = DotFlow()

workflow.task.add(step=simple_one, callback=callback_one)
workflow.task.add(step=simple_two, callback=callback_two)
workflow.add(step=simple_one, callback=callback_one)
workflow.add(step=simple_two, callback=callback_two)
workflow.start(keep_going=True)

return workflow
Expand Down
6 changes: 3 additions & 3 deletions docs_src/callback/workflow_callback_failure.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
from typing import List

from dotflow import DotFlow, action, Task
from dotflow.core.types.status import TypeStatus
from dotflow.core.types.status import StatusTaskType


def callback(tasks: List[Task]):
assert tasks
assert len(tasks)

for task in tasks:
assert task.status is TypeStatus.FAILED
assert task.status is StatusTaskType.FAILED
print(task.task_id, task.status, task.current_context.storage)


Expand All @@ -21,7 +21,7 @@ def simple_step():
def main():
workflow = DotFlow()

workflow.task.add(step=simple_step)
workflow.add(step=simple_step)
workflow.start(on_failure=callback)

return workflow
Expand Down
6 changes: 3 additions & 3 deletions docs_src/callback/workflow_callback_success.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
from typing import List

from dotflow import DotFlow, action, Task
from dotflow.core.types.status import TypeStatus
from dotflow.core.types.status import StatusTaskType


def callback(tasks: List[Task]):
assert tasks
assert len(tasks)

for task in tasks:
assert task.status is TypeStatus.COMPLETED
assert task.status is StatusTaskType.COMPLETED
print(task.task_id, task.status, task.current_context.storage)


Expand All @@ -21,7 +21,7 @@ def simple_step():
def main():
workflow = DotFlow()

workflow.task.add(step=simple_step)
workflow.add(step=simple_step)
workflow.start(on_success=callback)

return workflow
Expand Down
20 changes: 20 additions & 0 deletions docs_src/config/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from dotflow import Config, DotFlow, action


@action
def my_task():
print("task")


def main():
my_config = Config()

workflow = DotFlow(config=my_config)
workflow.add(step=my_task)
workflow.start()

return workflow


if __name__ == "__main__":
main()
8 changes: 4 additions & 4 deletions docs_src/first_steps/first_steps.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from dotflow import DotFlow, action
from dotflow import DotFlow, action, Task


def my_callback(*args, **kwargs):
print(args, kwargs)
def my_callback(task: Task):
print(task.status)


@action
Expand All @@ -11,5 +11,5 @@ def my_task():


workflow = DotFlow()
workflow.task.add(step=my_task, callback=my_callback)
workflow.add(step=my_task, callback=my_callback)
workflow.start()
12 changes: 6 additions & 6 deletions docs_src/initial_context/initial_context.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
from dotflow import DotFlow, action
from dotflow import DotFlow, action, Context


@action
def extract_task(initial_context):
def extract_task(initial_context: Context):
print(initial_context.storage, "extract")
assert initial_context.storage == {"foo": True}

return "extract"


@action
def transform_task(initial_context):
def transform_task(initial_context: Context):
print(initial_context.storage, "transform")
assert initial_context.storage == {"bar": True}

Expand All @@ -25,9 +25,9 @@ def load_task():
def main():
workflow = DotFlow()

workflow.task.add(step=extract_task, initial_context={"foo": True})
workflow.task.add(step=transform_task, initial_context={"bar": True})
workflow.task.add(step=load_task)
workflow.add(step=extract_task, initial_context={"foo": True})
workflow.add(step=transform_task, initial_context={"bar": True})
workflow.add(step=load_task)

workflow.start()

Expand Down
2 changes: 1 addition & 1 deletion docs_src/output/step_class_result_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def second_function(self):
def main():
workflow = DotFlow()

workflow.task.add(step=Step)
workflow.add(step=Step)
workflow.start()

for contexts in workflow.result_context():
Expand Down
2 changes: 1 addition & 1 deletion docs_src/output/step_class_result_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def second_function(self):
def main():
workflow = DotFlow()

workflow.task.add(step=Step)
workflow.add(step=Step)
workflow.start()

for storages in workflow.result_storage():
Expand Down
2 changes: 1 addition & 1 deletion docs_src/output/step_class_result_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def second_function(self):
def main():
workflow = DotFlow()

workflow.task.add(step=Step)
workflow.add(step=Step)
workflow.start()

for task in workflow.result_task():
Expand Down
2 changes: 1 addition & 1 deletion docs_src/output/step_function_result_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def simple_step():
def main():
workflow = DotFlow()

workflow.task.add(step=simple_step)
workflow.add(step=simple_step)
workflow.start()

for context in workflow.result_context():
Expand Down
2 changes: 1 addition & 1 deletion docs_src/output/step_function_result_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def simple_step():
def main():
workflow = DotFlow()

workflow.task.add(step=simple_step)
workflow.add(step=simple_step)
workflow.start()

for storage in workflow.result_storage():
Expand Down
2 changes: 1 addition & 1 deletion docs_src/output/step_function_result_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def simple_step():
def main():
workflow = DotFlow()

workflow.task.add(step=simple_step)
workflow.add(step=simple_step)
workflow.start()

for task in workflow.result_task():
Expand Down
6 changes: 3 additions & 3 deletions docs_src/previous_context/previous_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ def load_task(previous_context: Context):
def main():
workflow = DotFlow()

workflow.task.add(step=extract_task)
workflow.task.add(step=transform_task)
workflow.task.add(step=load_task)
workflow.add(step=extract_task)
workflow.add(step=transform_task)
workflow.add(step=load_task)

workflow.start()

Expand Down
Loading