dotflow 0.13.0.dev2__tar.gz → 0.13.2.dev1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/PKG-INFO +43 -38
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/README.md +40 -36
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/__init__.py +1 -2
- dotflow-0.13.2.dev1/dotflow/abc/api.py +24 -0
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/abc/file.py +1 -8
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/abc/flow.py +6 -8
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/abc/http.py +1 -2
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/abc/log.py +1 -2
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/abc/notify.py +1 -2
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/abc/storage.py +1 -1
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/abc/tcp.py +1 -3
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/cli/command.py +0 -1
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/cli/commands/__init__.py +1 -6
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/cli/commands/init.py +2 -3
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/cli/commands/log.py +3 -4
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/cli/commands/start.py +4 -8
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/cli/setup.py +14 -11
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/cli/validators/__init__.py +1 -4
- dotflow-0.13.2.dev1/dotflow/cli/validators/start.py +13 -0
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/core/action.py +21 -18
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/core/config.py +9 -8
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/core/context.py +7 -13
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/core/decorators/__init__.py +1 -4
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/core/decorators/time.py +3 -1
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/core/dotflow.py +6 -14
- dotflow-0.13.2.dev1/dotflow/core/exception.py +52 -0
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/core/execution.py +8 -9
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/core/module.py +3 -10
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/core/serializers/task.py +13 -11
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/core/serializers/transport.py +2 -5
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/core/serializers/workflow.py +2 -3
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/core/task.py +21 -31
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/core/types/__init__.py +1 -6
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/core/types/execution.py +5 -3
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/core/types/status.py +9 -7
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/core/types/storage.py +4 -2
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/core/workflow.py +97 -84
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/logging.py +1 -3
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/main.py +2 -6
- dotflow-0.13.0.dev2/dotflow/providers.py → dotflow-0.13.2.dev1/dotflow/providers/__init__.py +2 -2
- dotflow-0.13.2.dev1/dotflow/providers/api_default.py +158 -0
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/providers/log_default.py +0 -1
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/providers/notify_default.py +0 -1
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/providers/notify_telegram.py +5 -6
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/providers/storage_default.py +1 -1
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/providers/storage_file.py +7 -4
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/storage.py +3 -2
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/types.py +1 -4
- dotflow-0.13.2.dev1/dotflow/utils/__init__.py +14 -0
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/utils/error_handler.py +3 -1
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/utils/tools.py +6 -16
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/pyproject.toml +14 -6
- dotflow-0.13.0.dev2/dotflow/cli/validators/start.py +0 -16
- dotflow-0.13.0.dev2/dotflow/core/exception.py +0 -70
- dotflow-0.13.0.dev2/dotflow/notify.py +0 -6
- dotflow-0.13.0.dev2/dotflow/providers/__init__.py +0 -6
- dotflow-0.13.0.dev2/dotflow/utils/__init__.py +0 -15
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/LICENSE +0 -0
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/abc/__init__.py +0 -0
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/cli/__init__.py +0 -0
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/core/__init__.py +0 -0
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/core/serializers/__init__.py +0 -0
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/core/types/worflow.py +0 -0
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/settings.py +0 -0
- {dotflow-0.13.0.dev2 → dotflow-0.13.2.dev1}/dotflow/utils/basic_functions.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: dotflow
|
|
3
|
-
Version: 0.13.
|
|
3
|
+
Version: 0.13.2.dev1
|
|
4
4
|
Summary: 🎲 Dotflow turns an idea into flow!
|
|
5
5
|
License: MIT License
|
|
6
6
|
|
|
@@ -23,6 +23,7 @@ License: MIT License
|
|
|
23
23
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
24
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
25
|
SOFTWARE.
|
|
26
|
+
License-File: LICENSE
|
|
26
27
|
Author: Fernando Celmer
|
|
27
28
|
Author-email: email@fernandocelmer.com
|
|
28
29
|
Requires-Python: >=3.9
|
|
@@ -75,7 +76,7 @@ With Dotflow, you get a powerful and easy-to-use library designed to create exec
|
|
|
75
76
|
|
|
76
77
|
Our goal is to make task management faster and more secure, without overwhelming you with complexity. Simply instantiate the DotFlow class, add your tasks with the `add` method, and start execution with the `start` method.
|
|
77
78
|
|
|
78
|
-
Start with the basics [here](https://dotflow-io.github.io/dotflow/
|
|
79
|
+
Start with the basics [here](https://dotflow-io.github.io/dotflow/).
|
|
79
80
|
|
|
80
81
|
## Table of Contents
|
|
81
82
|
|
|
@@ -109,8 +110,9 @@ Start with the basics [here](https://dotflow-io.github.io/dotflow/nav/getting-st
|
|
|
109
110
|
We use GitHub issues for tracking bugs and feature requests and have limited bandwidth to address them. If you need anything, I ask you to please follow our templates for opening issues or discussions.
|
|
110
111
|
|
|
111
112
|
- 🐛 [Bug Report](https://github.com/dotflow-io/dotflow/issues/new/choose)
|
|
112
|
-
- 📕 [Documentation
|
|
113
|
+
- 📕 [Documentation](https://github.com/dotflow-io/dotflow/issues/new/choose)
|
|
113
114
|
- 🚀 [Feature Request](https://github.com/dotflow-io/dotflow/issues/new/choose)
|
|
115
|
+
- ⚠️ [Security Issue](https://github.com/dotflow-io/dotflow/issues/new/choose)
|
|
114
116
|
- 💬 [General Question](https://github.com/dotflow-io/dotflow/issues/new/choose)
|
|
115
117
|
|
|
116
118
|
## Getting Started
|
|
@@ -282,31 +284,6 @@ D[Finish]
|
|
|
282
284
|
|
|
283
285
|
</details>
|
|
284
286
|
|
|
285
|
-
#### Sequential with Groups
|
|
286
|
-
|
|
287
|
-
```python
|
|
288
|
-
workflow.task.add(step=task_foo, group_name="foo")
|
|
289
|
-
workflow.task.add(step=task_bar, group_name="bar")
|
|
290
|
-
|
|
291
|
-
workflow.start()
|
|
292
|
-
```
|
|
293
|
-
|
|
294
|
-
<details>
|
|
295
|
-
<summary>Click to see diagram</summary>
|
|
296
|
-
|
|
297
|
-
```mermaid
|
|
298
|
-
flowchart TD
|
|
299
|
-
A[Start] -->|run| C(Parallel Groups)
|
|
300
|
-
C -->|run| D[task_a]
|
|
301
|
-
C -->|run| E[task_c]
|
|
302
|
-
D -->|response| X[task_b]
|
|
303
|
-
X --> H[Finish]
|
|
304
|
-
E -->|response| Y[task_d]
|
|
305
|
-
Y --> H[Finish]
|
|
306
|
-
```
|
|
307
|
-
|
|
308
|
-
</details>
|
|
309
|
-
|
|
310
287
|
#### Background
|
|
311
288
|
|
|
312
289
|
```python
|
|
@@ -357,6 +334,31 @@ flowchart TD
|
|
|
357
334
|
|
|
358
335
|
</details>
|
|
359
336
|
|
|
337
|
+
#### Parallel with Groups
|
|
338
|
+
|
|
339
|
+
```python
|
|
340
|
+
workflow.task.add(step=task_foo, group_name="foo")
|
|
341
|
+
workflow.task.add(step=task_bar, group_name="bar")
|
|
342
|
+
|
|
343
|
+
workflow.start()
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
<details>
|
|
347
|
+
<summary>Click to see diagram</summary>
|
|
348
|
+
|
|
349
|
+
```mermaid
|
|
350
|
+
flowchart TD
|
|
351
|
+
A[Start] -->|run| C(Parallel Groups)
|
|
352
|
+
C -->|run| D[task_a]
|
|
353
|
+
C -->|run| E[task_c]
|
|
354
|
+
D -->|response| X[task_b]
|
|
355
|
+
X --> H[Finish]
|
|
356
|
+
E -->|response| Y[task_d]
|
|
357
|
+
Y --> H[Finish]
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
</details>
|
|
361
|
+
|
|
360
362
|
## More Examples
|
|
361
363
|
|
|
362
364
|
| Example | Command |
|
|
@@ -399,17 +401,20 @@ flowchart TD
|
|
|
399
401
|
|
|
400
402
|
## Commit Style
|
|
401
403
|
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
404
|
+
| Icon | Type | Description |
|
|
405
|
+
|------|-----------|--------------------------------------------|
|
|
406
|
+
| ⚙️ | FEATURE | New feature |
|
|
407
|
+
| 📝 | PEP8 | Formatting fixes following PEP8 |
|
|
408
|
+
| 📌 | ISSUE | Reference to issue |
|
|
409
|
+
| 🪲 | BUG | Bug fix |
|
|
410
|
+
| 📘 | DOCS | Documentation changes |
|
|
411
|
+
| 📦 | PyPI | PyPI releases |
|
|
412
|
+
| ❤️️ | TEST | Automated tests |
|
|
413
|
+
| ⬆️ | CI/CD | Changes in continuous integration/delivery |
|
|
414
|
+
| ⚠️ | SECURITY | Security improvements |
|
|
411
415
|
|
|
412
416
|
## License
|
|
417
|
+
|
|
413
418
|

|
|
414
419
|
|
|
415
420
|
This project is licensed under the terms of the MIT License.
|
|
@@ -26,7 +26,7 @@ With Dotflow, you get a powerful and easy-to-use library designed to create exec
|
|
|
26
26
|
|
|
27
27
|
Our goal is to make task management faster and more secure, without overwhelming you with complexity. Simply instantiate the DotFlow class, add your tasks with the `add` method, and start execution with the `start` method.
|
|
28
28
|
|
|
29
|
-
Start with the basics [here](https://dotflow-io.github.io/dotflow/
|
|
29
|
+
Start with the basics [here](https://dotflow-io.github.io/dotflow/).
|
|
30
30
|
|
|
31
31
|
## Table of Contents
|
|
32
32
|
|
|
@@ -60,8 +60,9 @@ Start with the basics [here](https://dotflow-io.github.io/dotflow/nav/getting-st
|
|
|
60
60
|
We use GitHub issues for tracking bugs and feature requests and have limited bandwidth to address them. If you need anything, I ask you to please follow our templates for opening issues or discussions.
|
|
61
61
|
|
|
62
62
|
- 🐛 [Bug Report](https://github.com/dotflow-io/dotflow/issues/new/choose)
|
|
63
|
-
- 📕 [Documentation
|
|
63
|
+
- 📕 [Documentation](https://github.com/dotflow-io/dotflow/issues/new/choose)
|
|
64
64
|
- 🚀 [Feature Request](https://github.com/dotflow-io/dotflow/issues/new/choose)
|
|
65
|
+
- ⚠️ [Security Issue](https://github.com/dotflow-io/dotflow/issues/new/choose)
|
|
65
66
|
- 💬 [General Question](https://github.com/dotflow-io/dotflow/issues/new/choose)
|
|
66
67
|
|
|
67
68
|
## Getting Started
|
|
@@ -233,31 +234,6 @@ D[Finish]
|
|
|
233
234
|
|
|
234
235
|
</details>
|
|
235
236
|
|
|
236
|
-
#### Sequential with Groups
|
|
237
|
-
|
|
238
|
-
```python
|
|
239
|
-
workflow.task.add(step=task_foo, group_name="foo")
|
|
240
|
-
workflow.task.add(step=task_bar, group_name="bar")
|
|
241
|
-
|
|
242
|
-
workflow.start()
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
<details>
|
|
246
|
-
<summary>Click to see diagram</summary>
|
|
247
|
-
|
|
248
|
-
```mermaid
|
|
249
|
-
flowchart TD
|
|
250
|
-
A[Start] -->|run| C(Parallel Groups)
|
|
251
|
-
C -->|run| D[task_a]
|
|
252
|
-
C -->|run| E[task_c]
|
|
253
|
-
D -->|response| X[task_b]
|
|
254
|
-
X --> H[Finish]
|
|
255
|
-
E -->|response| Y[task_d]
|
|
256
|
-
Y --> H[Finish]
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
</details>
|
|
260
|
-
|
|
261
237
|
#### Background
|
|
262
238
|
|
|
263
239
|
```python
|
|
@@ -308,6 +284,31 @@ flowchart TD
|
|
|
308
284
|
|
|
309
285
|
</details>
|
|
310
286
|
|
|
287
|
+
#### Parallel with Groups
|
|
288
|
+
|
|
289
|
+
```python
|
|
290
|
+
workflow.task.add(step=task_foo, group_name="foo")
|
|
291
|
+
workflow.task.add(step=task_bar, group_name="bar")
|
|
292
|
+
|
|
293
|
+
workflow.start()
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
<details>
|
|
297
|
+
<summary>Click to see diagram</summary>
|
|
298
|
+
|
|
299
|
+
```mermaid
|
|
300
|
+
flowchart TD
|
|
301
|
+
A[Start] -->|run| C(Parallel Groups)
|
|
302
|
+
C -->|run| D[task_a]
|
|
303
|
+
C -->|run| E[task_c]
|
|
304
|
+
D -->|response| X[task_b]
|
|
305
|
+
X --> H[Finish]
|
|
306
|
+
E -->|response| Y[task_d]
|
|
307
|
+
Y --> H[Finish]
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
</details>
|
|
311
|
+
|
|
311
312
|
## More Examples
|
|
312
313
|
|
|
313
314
|
| Example | Command |
|
|
@@ -350,17 +351,20 @@ flowchart TD
|
|
|
350
351
|
|
|
351
352
|
## Commit Style
|
|
352
353
|
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
354
|
+
| Icon | Type | Description |
|
|
355
|
+
|------|-----------|--------------------------------------------|
|
|
356
|
+
| ⚙️ | FEATURE | New feature |
|
|
357
|
+
| 📝 | PEP8 | Formatting fixes following PEP8 |
|
|
358
|
+
| 📌 | ISSUE | Reference to issue |
|
|
359
|
+
| 🪲 | BUG | Bug fix |
|
|
360
|
+
| 📘 | DOCS | Documentation changes |
|
|
361
|
+
| 📦 | PyPI | PyPI releases |
|
|
362
|
+
| ❤️️ | TEST | Automated tests |
|
|
363
|
+
| ⬆️ | CI/CD | Changes in continuous integration/delivery |
|
|
364
|
+
| ⚠️ | SECURITY | Security improvements |
|
|
362
365
|
|
|
363
366
|
## License
|
|
367
|
+
|
|
364
368
|

|
|
365
369
|
|
|
366
370
|
This project is licensed under the terms of the MIT License.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Dotflow __init__ module."""
|
|
2
2
|
|
|
3
|
-
__version__ = "0.13.
|
|
3
|
+
__version__ = "0.13.2.dev1"
|
|
4
4
|
__description__ = "🎲 Dotflow turns an idea into flow!"
|
|
5
5
|
|
|
6
6
|
from .core.action import Action as action
|
|
@@ -9,5 +9,4 @@ from .core.context import Context
|
|
|
9
9
|
from .core.dotflow import DotFlow
|
|
10
10
|
from .core.task import Task
|
|
11
11
|
|
|
12
|
-
|
|
13
12
|
__all__ = ["action", "Context", "Config", "DotFlow", "Task"]
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"""Abstract base for optional remote API persistence."""
|
|
2
|
+
|
|
3
|
+
from abc import ABC, abstractmethod
|
|
4
|
+
from typing import Any
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Api(ABC):
|
|
8
|
+
"""Api"""
|
|
9
|
+
|
|
10
|
+
@abstractmethod
|
|
11
|
+
def create_workflow(self, workflow: Any) -> None:
|
|
12
|
+
"""Create workflow"""
|
|
13
|
+
|
|
14
|
+
@abstractmethod
|
|
15
|
+
def update_workflow(self, workflow: Any) -> None:
|
|
16
|
+
"""Update workflow"""
|
|
17
|
+
|
|
18
|
+
@abstractmethod
|
|
19
|
+
def create_task(self, task: Any) -> None:
|
|
20
|
+
"""Create task"""
|
|
21
|
+
|
|
22
|
+
@abstractmethod
|
|
23
|
+
def update_task(self, task: Any) -> None:
|
|
24
|
+
"""Update task"""
|
|
@@ -4,16 +4,9 @@ from abc import ABC, abstractmethod
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
class FileClient(ABC):
|
|
7
|
-
|
|
8
7
|
@abstractmethod
|
|
9
8
|
@classmethod
|
|
10
|
-
def write(
|
|
11
|
-
self,
|
|
12
|
-
path: str,
|
|
13
|
-
content: str,
|
|
14
|
-
mode: str,
|
|
15
|
-
encoding: str
|
|
16
|
-
) -> None:
|
|
9
|
+
def write(self, path: str, content: str, mode: str, encoding: str) -> None:
|
|
17
10
|
pass
|
|
18
11
|
|
|
19
12
|
@abstractmethod
|
|
@@ -2,19 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
from abc import ABC, abstractmethod
|
|
4
4
|
from uuid import UUID
|
|
5
|
-
from typing import Dict, List
|
|
6
5
|
|
|
7
6
|
from dotflow.core.task import Task
|
|
8
7
|
|
|
9
8
|
|
|
10
9
|
class Flow(ABC):
|
|
11
|
-
|
|
12
10
|
def __init__(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
self,
|
|
12
|
+
tasks: list[Task],
|
|
13
|
+
workflow_id: UUID,
|
|
14
|
+
ignore: bool,
|
|
15
|
+
groups: dict[str, list[Task]],
|
|
18
16
|
) -> None:
|
|
19
17
|
self.queue = None
|
|
20
18
|
self.tasks = tasks
|
|
@@ -30,7 +28,7 @@ class Flow(ABC):
|
|
|
30
28
|
self.queue = []
|
|
31
29
|
|
|
32
30
|
@abstractmethod
|
|
33
|
-
def get_tasks(self) ->
|
|
31
|
+
def get_tasks(self) -> list[Task]:
|
|
34
32
|
return self.queue
|
|
35
33
|
|
|
36
34
|
@abstractmethod
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"""TCP module"""
|
|
2
2
|
|
|
3
3
|
from abc import ABC, abstractmethod
|
|
4
|
-
from
|
|
4
|
+
from collections.abc import Callable
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
class TCPClient(ABC):
|
|
8
|
-
|
|
9
8
|
def __init__(self, url: str):
|
|
10
9
|
self.url = url
|
|
11
10
|
self.context = None
|
|
@@ -16,7 +15,6 @@ class TCPClient(ABC):
|
|
|
16
15
|
|
|
17
16
|
|
|
18
17
|
class TCPServer(ABC):
|
|
19
|
-
|
|
20
18
|
def __init__(self, url: str, handler: Callable):
|
|
21
19
|
self.url = url
|
|
22
20
|
self.handler = handler
|
|
@@ -4,9 +4,4 @@ from dotflow.cli.commands.init import InitCommand
|
|
|
4
4
|
from dotflow.cli.commands.log import LogCommand
|
|
5
5
|
from dotflow.cli.commands.start import StartCommand
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
__all__ = [
|
|
9
|
-
"InitCommand",
|
|
10
|
-
"LogCommand",
|
|
11
|
-
"StartCommand"
|
|
12
|
-
]
|
|
7
|
+
__all__ = ["InitCommand", "LogCommand", "StartCommand"]
|
|
@@ -4,16 +4,15 @@ from os import system
|
|
|
4
4
|
|
|
5
5
|
from rich import print # type: ignore
|
|
6
6
|
|
|
7
|
-
from dotflow.settings import Settings as settings
|
|
8
7
|
from dotflow.cli.command import Command
|
|
8
|
+
from dotflow.settings import Settings as settings
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class InitCommand(Command):
|
|
12
|
-
|
|
13
12
|
def setup(self):
|
|
14
13
|
if settings.GITIGNORE.exists():
|
|
15
14
|
system("echo '\n\n# Dotflow\n.output' >> .gitignore")
|
|
16
15
|
print(
|
|
17
16
|
settings.INFO_ALERT,
|
|
18
|
-
f"Installation complete! The ({settings.GITIGNORE.resolve()}) file has been modified."
|
|
17
|
+
f"Installation complete! The ({settings.GITIGNORE.resolve()}) file has been modified.",
|
|
19
18
|
)
|
|
@@ -2,20 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
from rich import print # type: ignore
|
|
4
4
|
|
|
5
|
-
from dotflow.utils import read_file
|
|
6
|
-
from dotflow.settings import Settings as settings
|
|
7
5
|
from dotflow.cli.command import Command
|
|
6
|
+
from dotflow.settings import Settings as settings
|
|
7
|
+
from dotflow.utils import read_file
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class LogCommand(Command):
|
|
11
|
-
|
|
12
11
|
def setup(self):
|
|
13
12
|
if settings.LOG_PATH.exists():
|
|
14
13
|
print(read_file(path=settings.LOG_PATH))
|
|
15
14
|
|
|
16
15
|
print(
|
|
17
16
|
settings.INFO_ALERT,
|
|
18
|
-
f"To access all logs, open the file ({settings.LOG_PATH.resolve()})."
|
|
17
|
+
f"To access all logs, open the file ({settings.LOG_PATH.resolve()}).",
|
|
19
18
|
)
|
|
20
19
|
else:
|
|
21
20
|
print(settings.WARNING_ALERT, "Log file not found.")
|
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
from os import system
|
|
4
4
|
|
|
5
|
-
from dotflow import
|
|
6
|
-
from dotflow.providers import StorageDefault, StorageFile
|
|
7
|
-
from dotflow.core.types.execution import TypeExecution
|
|
5
|
+
from dotflow import Config, DotFlow
|
|
8
6
|
from dotflow.cli.command import Command
|
|
7
|
+
from dotflow.core.types.execution import TypeExecution
|
|
8
|
+
from dotflow.providers import StorageDefault, StorageFile
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class StartCommand(Command):
|
|
12
|
-
|
|
13
12
|
def setup(self):
|
|
14
13
|
workflow = self._new_workflow()
|
|
15
14
|
|
|
@@ -28,10 +27,7 @@ class StartCommand(Command):
|
|
|
28
27
|
if not self.params.storage:
|
|
29
28
|
return DotFlow()
|
|
30
29
|
|
|
31
|
-
storage_classes = {
|
|
32
|
-
"default": StorageDefault,
|
|
33
|
-
"file": StorageFile
|
|
34
|
-
}
|
|
30
|
+
storage_classes = {"default": StorageDefault, "file": StorageFile}
|
|
35
31
|
|
|
36
32
|
config = Config(
|
|
37
33
|
storage=storage_classes.get(self.params.storage)(
|
|
@@ -2,22 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
from rich import print # type: ignore
|
|
4
4
|
|
|
5
|
-
from dotflow import
|
|
6
|
-
from dotflow.
|
|
7
|
-
from dotflow.settings import Settings as settings
|
|
8
|
-
from dotflow.utils.basic_functions import basic_callback
|
|
9
|
-
from dotflow.core.types import TypeExecution, TypeStorage
|
|
5
|
+
from dotflow import __description__, __version__
|
|
6
|
+
from dotflow.cli.commands import InitCommand, LogCommand, StartCommand
|
|
10
7
|
from dotflow.core.exception import (
|
|
11
|
-
|
|
8
|
+
MESSAGE_UNKNOWN_ERROR,
|
|
12
9
|
ExecutionModeNotExist,
|
|
13
10
|
ImportModuleError,
|
|
14
|
-
|
|
11
|
+
MissingActionDecorator,
|
|
15
12
|
)
|
|
16
|
-
from dotflow.
|
|
13
|
+
from dotflow.core.types import TypeExecution, TypeStorage
|
|
14
|
+
from dotflow.logging import logger
|
|
15
|
+
from dotflow.settings import Settings as settings
|
|
16
|
+
from dotflow.utils.basic_functions import basic_callback
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
class Command:
|
|
20
|
-
|
|
21
20
|
def __init__(self, parser):
|
|
22
21
|
self.parser = parser
|
|
23
22
|
self.subparsers = self.parser.add_subparsers()
|
|
@@ -55,7 +54,9 @@ class Command:
|
|
|
55
54
|
self.cmd_start.add_argument(
|
|
56
55
|
"-o", "--storage", choices=[TypeStorage.DEFAULT, TypeStorage.FILE]
|
|
57
56
|
)
|
|
58
|
-
self.cmd_start.add_argument(
|
|
57
|
+
self.cmd_start.add_argument(
|
|
58
|
+
"-p", "--path", default=settings.START_PATH
|
|
59
|
+
)
|
|
59
60
|
self.cmd_start.add_argument(
|
|
60
61
|
"-m",
|
|
61
62
|
"--mode",
|
|
@@ -71,7 +72,9 @@ class Command:
|
|
|
71
72
|
|
|
72
73
|
def setup_logs(self):
|
|
73
74
|
self.cmd_logs = self.subparsers.add_parser("logs", help="Logs")
|
|
74
|
-
self.cmd_logs = self.cmd_logs.add_argument_group(
|
|
75
|
+
self.cmd_logs = self.cmd_logs.add_argument_group(
|
|
76
|
+
"Usage: dotflow log [OPTIONS]"
|
|
77
|
+
)
|
|
75
78
|
self.cmd_logs.set_defaults(exec=LogCommand)
|
|
76
79
|
|
|
77
80
|
def command(self):
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"""Start validator module"""
|
|
2
|
+
|
|
3
|
+
from pydantic import BaseModel, Field # type: ignore
|
|
4
|
+
|
|
5
|
+
from dotflow.settings import Settings as settings
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class StartValidator(BaseModel):
|
|
9
|
+
step: str
|
|
10
|
+
callable: str | None = Field(default=None)
|
|
11
|
+
initial_context: str | None = Field(default=None)
|
|
12
|
+
output: bool | None = Field(default=True)
|
|
13
|
+
path: str | None = Field(default=settings.START_PATH)
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"""Action module"""
|
|
2
2
|
|
|
3
|
-
from
|
|
4
|
-
|
|
3
|
+
from collections.abc import Callable
|
|
5
4
|
from concurrent.futures import ThreadPoolExecutor
|
|
6
|
-
from
|
|
5
|
+
from time import sleep
|
|
7
6
|
from types import FunctionType
|
|
8
7
|
|
|
9
|
-
from dotflow.core.exception import ExecutionWithClassError
|
|
10
8
|
from dotflow.core.context import Context
|
|
9
|
+
from dotflow.core.exception import ExecutionWithClassError
|
|
11
10
|
|
|
12
11
|
|
|
13
12
|
def is_execution_with_class_internal_error(error: Exception) -> bool:
|
|
@@ -20,7 +19,7 @@ def is_execution_with_class_internal_error(error: Exception) -> bool:
|
|
|
20
19
|
return any(pattern in message for pattern in patterns)
|
|
21
20
|
|
|
22
21
|
|
|
23
|
-
class Action
|
|
22
|
+
class Action:
|
|
24
23
|
"""
|
|
25
24
|
Import:
|
|
26
25
|
You can import the **action** decorator directly from dotflow:
|
|
@@ -150,11 +149,13 @@ class Action(object):
|
|
|
150
149
|
except Exception as error:
|
|
151
150
|
last_exception = error
|
|
152
151
|
|
|
153
|
-
if is_execution_with_class_internal_error(
|
|
154
|
-
|
|
152
|
+
if is_execution_with_class_internal_error(
|
|
153
|
+
error=last_exception
|
|
154
|
+
):
|
|
155
|
+
raise ExecutionWithClassError() from None
|
|
155
156
|
|
|
156
157
|
if attempt == self.retry:
|
|
157
|
-
raise last_exception
|
|
158
|
+
raise last_exception from last_exception
|
|
158
159
|
|
|
159
160
|
sleep(self.retry_delay)
|
|
160
161
|
if self.backoff:
|
|
@@ -162,24 +163,26 @@ class Action(object):
|
|
|
162
163
|
|
|
163
164
|
def _set_params(self):
|
|
164
165
|
if isinstance(self.func, FunctionType):
|
|
165
|
-
self.params =
|
|
166
|
+
self.params = list(self.func.__code__.co_varnames)
|
|
166
167
|
|
|
167
|
-
if
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
168
|
+
if (
|
|
169
|
+
type(self.func) is type
|
|
170
|
+
and hasattr(self.func, "__init__")
|
|
171
|
+
and hasattr(self.func.__init__, "__code__")
|
|
172
|
+
):
|
|
173
|
+
self.params = list(self.func.__init__.__code__.co_varnames)
|
|
173
174
|
|
|
174
|
-
def _get_context(self, kwargs:
|
|
175
|
+
def _get_context(self, kwargs: dict):
|
|
175
176
|
context = {}
|
|
176
177
|
if "initial_context" in self.params:
|
|
177
178
|
context["initial_context"] = Context(kwargs.get("initial_context"))
|
|
178
179
|
|
|
179
180
|
if "previous_context" in self.params:
|
|
180
|
-
context["previous_context"] = Context(
|
|
181
|
+
context["previous_context"] = Context(
|
|
182
|
+
kwargs.get("previous_context")
|
|
183
|
+
)
|
|
181
184
|
|
|
182
185
|
return context
|
|
183
186
|
|
|
184
|
-
def _get_task(self, kwargs:
|
|
187
|
+
def _get_task(self, kwargs: dict):
|
|
185
188
|
return kwargs.get("task")
|