ddeutil-workflow 0.0.49__py3-none-any.whl → 0.0.51__py3-none-any.whl
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.
- ddeutil/workflow/__about__.py +1 -1
- ddeutil/workflow/__init__.py +8 -26
- ddeutil/workflow/conf.py +11 -11
- ddeutil/workflow/cron.py +46 -20
- ddeutil/workflow/exceptions.py +3 -3
- ddeutil/workflow/job.py +269 -145
- ddeutil/workflow/logs.py +23 -19
- ddeutil/workflow/params.py +56 -16
- ddeutil/workflow/result.py +12 -4
- ddeutil/workflow/reusables.py +4 -2
- ddeutil/workflow/scheduler.py +5 -1
- ddeutil/workflow/stages.py +580 -217
- ddeutil/workflow/utils.py +42 -38
- ddeutil/workflow/workflow.py +92 -95
- {ddeutil_workflow-0.0.49.dist-info → ddeutil_workflow-0.0.51.dist-info}/METADATA +71 -14
- ddeutil_workflow-0.0.51.dist-info/RECORD +31 -0
- ddeutil_workflow-0.0.49.dist-info/RECORD +0 -31
- {ddeutil_workflow-0.0.49.dist-info → ddeutil_workflow-0.0.51.dist-info}/WHEEL +0 -0
- {ddeutil_workflow-0.0.49.dist-info → ddeutil_workflow-0.0.51.dist-info}/licenses/LICENSE +0 -0
- {ddeutil_workflow-0.0.49.dist-info → ddeutil_workflow-0.0.51.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: ddeutil-workflow
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.51
|
4
4
|
Summary: Lightweight workflow orchestration
|
5
5
|
Author-email: ddeutils <korawich.anu@gmail.com>
|
6
6
|
License: MIT
|
@@ -22,8 +22,8 @@ Classifier: Programming Language :: Python :: 3.13
|
|
22
22
|
Requires-Python: >=3.9.13
|
23
23
|
Description-Content-Type: text/markdown
|
24
24
|
License-File: LICENSE
|
25
|
-
Requires-Dist: ddeutil[checksum]>=0.4.
|
26
|
-
Requires-Dist: ddeutil-io[toml,yaml]>=0.2.
|
25
|
+
Requires-Dist: ddeutil[checksum]>=0.4.7
|
26
|
+
Requires-Dist: ddeutil-io[toml,yaml]>=0.2.11
|
27
27
|
Requires-Dist: pydantic==2.11.1
|
28
28
|
Requires-Dist: python-dotenv==1.1.0
|
29
29
|
Requires-Dist: schedule<2.0.0,==1.2.2
|
@@ -39,6 +39,8 @@ Requires-Dist: ujson; extra == "api"
|
|
39
39
|
Provides-Extra: async
|
40
40
|
Requires-Dist: aiofiles; extra == "async"
|
41
41
|
Requires-Dist: aiohttp; extra == "async"
|
42
|
+
Provides-Extra: docker
|
43
|
+
Requires-Dist: docker==7.1.0; extra == "docker"
|
42
44
|
Dynamic: license-file
|
43
45
|
|
44
46
|
# Workflow Orchestration
|
@@ -137,7 +139,8 @@ flowchart LR
|
|
137
139
|
|
138
140
|
## 📦 Installation
|
139
141
|
|
140
|
-
This project need `ddeutil` and `ddeutil-io` extension namespace packages
|
142
|
+
This project need `ddeutil` and `ddeutil-io` extension namespace packages to be
|
143
|
+
the base deps.
|
141
144
|
If you want to install this package with application add-ons, you should add
|
142
145
|
`app` in installation;
|
143
146
|
|
@@ -146,7 +149,7 @@ If you want to install this package with application add-ons, you should add
|
|
146
149
|
| Python | `ddeutil-workflow` | :heavy_check_mark: |
|
147
150
|
| FastAPI Server | `ddeutil-workflow[api]` | :heavy_check_mark: |
|
148
151
|
|
149
|
-
##
|
152
|
+
## 🎯 Usage
|
150
153
|
|
151
154
|
This is examples that use workflow file for running common Data Engineering
|
152
155
|
use-case.
|
@@ -196,12 +199,54 @@ run-py-local:
|
|
196
199
|
|
197
200
|
# Arguments of target data that want to land.
|
198
201
|
writing_mode: flatten
|
199
|
-
|
202
|
+
aws:
|
203
|
+
path: my-data/open-data/${{ params.source-extract }}
|
200
204
|
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
+
# This Authentication code should implement with your custom call
|
206
|
+
# function. The template allow you to use environment variable.
|
207
|
+
access_client_id: ${AWS_ACCESS_CLIENT_ID}
|
208
|
+
access_client_secret: ${AWS_ACCESS_CLIENT_SECRET}
|
209
|
+
```
|
210
|
+
|
211
|
+
Before execute this workflow, you should implement caller function first.
|
212
|
+
|
213
|
+
```text
|
214
|
+
registry-caller/
|
215
|
+
╰─ tasks.py
|
216
|
+
```
|
217
|
+
|
218
|
+
This function will store as module that will import from `WORKFLOW_CORE_REGISTRY_CALLER`
|
219
|
+
value (This config can override by extra parameters with `registry_caller` key).
|
220
|
+
|
221
|
+
```python
|
222
|
+
from ddeutil.workflow import Result, tag
|
223
|
+
from ddeutil.workflow.exceptions import StageException
|
224
|
+
from pydantic import BaseModel, SecretStr
|
225
|
+
|
226
|
+
class AwsCredential(BaseModel):
|
227
|
+
path: str
|
228
|
+
access_client_id: str
|
229
|
+
access_client_secret: SecretStr
|
230
|
+
|
231
|
+
class RestAuth(BaseModel):
|
232
|
+
type: str
|
233
|
+
keys: SecretStr
|
234
|
+
|
235
|
+
@tag("requests", alias="get-api-with-oauth-to-s3")
|
236
|
+
def get_api_with_oauth_to_s3(
|
237
|
+
method: str,
|
238
|
+
url: str,
|
239
|
+
body: dict[str, str],
|
240
|
+
auth: RestAuth,
|
241
|
+
writing_node: str,
|
242
|
+
aws: AwsCredential,
|
243
|
+
result: Result,
|
244
|
+
) -> dict[str, int]:
|
245
|
+
result.trace.info("[CALLER]: Start get data via RestAPI to S3.")
|
246
|
+
result.trace.info(f"... {method}: {url}")
|
247
|
+
if method != "post":
|
248
|
+
raise StageException(f"RestAPI does not support for {method} action.")
|
249
|
+
return {"records": 1000}
|
205
250
|
```
|
206
251
|
|
207
252
|
The above workflow template is main executor pipeline that you want to do. If you
|
@@ -268,7 +313,6 @@ it will use default value and do not raise any error to you.
|
|
268
313
|
| **TIMEZONE** | Core | `Asia/Bangkok` | A Timezone string value that will pass to `ZoneInfo` object. |
|
269
314
|
| **STAGE_DEFAULT_ID** | Core | `false` | A flag that enable default stage ID that use for catch an execution output. |
|
270
315
|
| **STAGE_RAISE_ERROR** | Core | `false` | A flag that all stage raise StageException from stage execution. |
|
271
|
-
| **JOB_RAISE_ERROR** | Core | `true` | A flag that all job raise JobException from job strategy execution. |
|
272
316
|
| **MAX_CRON_PER_WORKFLOW** | Core | `5` | |
|
273
317
|
| **MAX_QUEUE_COMPLETE_HIST** | Core | `16` | |
|
274
318
|
| **GENERATE_ID_SIMPLE_MODE** | Core | `true` | A flog that enable generating ID with `md5` algorithm. |
|
@@ -297,13 +341,15 @@ only.
|
|
297
341
|
## :rocket: Deployment
|
298
342
|
|
299
343
|
This package able to run as an application service for receive manual trigger
|
300
|
-
from
|
301
|
-
like crontab job but via Python API.
|
344
|
+
from any node via RestAPI or use to be Scheduler background application
|
345
|
+
like crontab job but via Python API or FastAPI app.
|
302
346
|
|
303
347
|
### API Server
|
304
348
|
|
349
|
+
This server use FastAPI package to be the base application.
|
350
|
+
|
305
351
|
```shell
|
306
|
-
(venv) $ uvicorn ddeutil.workflow.api:app \
|
352
|
+
(.venv) $ uvicorn ddeutil.workflow.api:app \
|
307
353
|
--host 127.0.0.1 \
|
308
354
|
--port 80 \
|
309
355
|
--no-access-log
|
@@ -313,8 +359,19 @@ like crontab job but via Python API.
|
|
313
359
|
> If this package already deploy, it is able to use multiprocess;
|
314
360
|
> `uvicorn ddeutil.workflow.api:app --host 127.0.0.1 --port 80 --workers 4`
|
315
361
|
|
362
|
+
### Local Schedule
|
363
|
+
|
364
|
+
> [!WARNING]
|
365
|
+
> This CLI does not implement yet.
|
366
|
+
|
367
|
+
```shell
|
368
|
+
(.venv) $ ddeutil-workflow schedule
|
369
|
+
```
|
370
|
+
|
316
371
|
### Docker Container
|
317
372
|
|
373
|
+
Build a Docker container from this package.
|
374
|
+
|
318
375
|
```shell
|
319
376
|
$ docker build -t ddeutil-workflow:latest -f .container/Dockerfile .
|
320
377
|
$ docker run -i ddeutil-workflow:latest ddeutil-workflow
|
@@ -0,0 +1,31 @@
|
|
1
|
+
ddeutil/workflow/__about__.py,sha256=lV_4ewekJpV5o1pQoqnMK3g475fbmyO855YKAFNFKF8,28
|
2
|
+
ddeutil/workflow/__cron.py,sha256=h8rLeIUAAEB2SdZ4Jhch7LU1Yl3bbJ-iNNJ3tQ0eYVM,28095
|
3
|
+
ddeutil/workflow/__init__.py,sha256=AMmM7Cq_jrO_MzIZjzQyFvcFkVj9ad7V1f3PtLrI030,1736
|
4
|
+
ddeutil/workflow/__main__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
|
+
ddeutil/workflow/__types.py,sha256=8jBdbfb3aZSetjz0mvNrpGHwwxJff7mK8_4v41cLqlc,4316
|
6
|
+
ddeutil/workflow/conf.py,sha256=80rgmJKFU7BlH5xTLnghGzGhE8C6LFAQykd9mjHSjo8,12528
|
7
|
+
ddeutil/workflow/cron.py,sha256=WS2MInn0Sp5DKlZDZH5VFZ5AA0Q3_AnBnYEU4lZSv4I,9779
|
8
|
+
ddeutil/workflow/exceptions.py,sha256=r4Jrf9qtVPALU4wh4bnb_OYqC-StqSQJEmFC-_QK934,1408
|
9
|
+
ddeutil/workflow/job.py,sha256=LydncguMUTTdcG_fImjoPFZBulmZT_PD3jYmnmcYskk,35041
|
10
|
+
ddeutil/workflow/logs.py,sha256=rsoBrUGQrooou18fg2yvPsB8NOaXnUA5ThQpBr_WVMg,26598
|
11
|
+
ddeutil/workflow/params.py,sha256=FKY4Oo1Ze4QZKRfAk7rqKsi44YaJQAbqAtXM6vlO2hI,11392
|
12
|
+
ddeutil/workflow/result.py,sha256=27nPQq9CETLCVczv4vvFEF9w2TllHZ_ROfyDoLFxRWM,5647
|
13
|
+
ddeutil/workflow/reusables.py,sha256=iXcS7Gg-71qVX4ln0ILTDx03cTtUnj_rNoXHTVdVrxc,17636
|
14
|
+
ddeutil/workflow/scheduler.py,sha256=4G5AogkmnsTKe7jKYSfU35qjubR82WQ8CLtEe9kqPTE,28304
|
15
|
+
ddeutil/workflow/stages.py,sha256=Ywwky6rJJ5cMvridG-1Y4rv-wJJ_WMbXysViR3WxQrY,69108
|
16
|
+
ddeutil/workflow/utils.py,sha256=zbVttaMFMRLuuBJdSJf7D9qtz8bOnQIBq-rHI3Eqy4M,7821
|
17
|
+
ddeutil/workflow/workflow.py,sha256=v_O3Gm4J6SCN_1NfGd3_ClpJkatFCyoqXR3nAIMAoF4,50575
|
18
|
+
ddeutil/workflow/api/__init__.py,sha256=F53NMBWtb9IKaDWkPU5KvybGGfKAcbehgn6TLBwHuuM,21
|
19
|
+
ddeutil/workflow/api/api.py,sha256=CWtPLgOv2Jus9E7nzG5mG2Z32ZEkUK3JWQ2htZyMRpA,5244
|
20
|
+
ddeutil/workflow/api/log.py,sha256=NMTnOnsBrDB5129329xF2myLdrb-z9k1MQrmrP7qXJw,1818
|
21
|
+
ddeutil/workflow/api/repeat.py,sha256=uTtUFVLpiYYahXvCVx8sueRQ03K2Xw1id_gW3IMmX1U,5295
|
22
|
+
ddeutil/workflow/api/routes/__init__.py,sha256=qoGtOMyVgQ5nTUc8J8wH27A8isaxl3IFCX8qoyibeCY,484
|
23
|
+
ddeutil/workflow/api/routes/job.py,sha256=oPwBVP0Mxwxv-bGPlfmxQQ9PcVl0ev9HoPzndpYDCCQ,1954
|
24
|
+
ddeutil/workflow/api/routes/logs.py,sha256=U6vOni3wd-ZTOwd3yVdSOpgyRmNdcgfngU5KlLM3Cww,5383
|
25
|
+
ddeutil/workflow/api/routes/schedules.py,sha256=EgUjyRGhsm6UNaMj5luh6TcY6l571sCHcla-BL1iOfY,4829
|
26
|
+
ddeutil/workflow/api/routes/workflows.py,sha256=JcDOrn1deK8ztFRcMTNATQejG6KMA7JxZLVc4QeBsP4,4527
|
27
|
+
ddeutil_workflow-0.0.51.dist-info/licenses/LICENSE,sha256=nGFZ1QEhhhWeMHf9n99_fdt4vQaXS29xWKxt-OcLywk,1085
|
28
|
+
ddeutil_workflow-0.0.51.dist-info/METADATA,sha256=xlAbUVZ9djYf1GImH9v0N-mR7XpxcQIkvwGuX5XmSrs,19425
|
29
|
+
ddeutil_workflow-0.0.51.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
30
|
+
ddeutil_workflow-0.0.51.dist-info/top_level.txt,sha256=m9M6XeSWDwt_yMsmH6gcOjHZVK5O0-vgtNBuncHjzW4,8
|
31
|
+
ddeutil_workflow-0.0.51.dist-info/RECORD,,
|
@@ -1,31 +0,0 @@
|
|
1
|
-
ddeutil/workflow/__about__.py,sha256=8c8KBEXeEOskazR5AlLYEjCpyi54xsoTaaqRY8pXUJY,28
|
2
|
-
ddeutil/workflow/__cron.py,sha256=h8rLeIUAAEB2SdZ4Jhch7LU1Yl3bbJ-iNNJ3tQ0eYVM,28095
|
3
|
-
ddeutil/workflow/__init__.py,sha256=EpqROKwAX76Wea-37hi0R_oVQ2jm2cc9ML9USxRAsak,1971
|
4
|
-
ddeutil/workflow/__main__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
|
-
ddeutil/workflow/__types.py,sha256=8jBdbfb3aZSetjz0mvNrpGHwwxJff7mK8_4v41cLqlc,4316
|
6
|
-
ddeutil/workflow/conf.py,sha256=lviP7bFsOCJtD8S1VyJK6aaSL9Nj_vfC2Kkpe1z2Zec,12444
|
7
|
-
ddeutil/workflow/cron.py,sha256=80SijzMdDOBxTWRsiF-Fmuz7Ym7leY0XT2lzRAPGdXc,8781
|
8
|
-
ddeutil/workflow/exceptions.py,sha256=uLNxzav3HRcr4vaZnvbUIF_eTR6UXXZNaxroMWFOUL4,1418
|
9
|
-
ddeutil/workflow/job.py,sha256=y2q_md2nUp1jfgjaQdjDZqrHR541ENrWB__S1-Eoyss,30830
|
10
|
-
ddeutil/workflow/logs.py,sha256=JghQawGd16ysf-5y7ZFtSGFY82uwgb9oMKNYy9eGI-o,26468
|
11
|
-
ddeutil/workflow/params.py,sha256=xCtFEh0-G-G-f8y_SXxyf31bU6Ox5p5Z-WbBFXrjy8M,9960
|
12
|
-
ddeutil/workflow/result.py,sha256=kizTEP6DY9ewDQQR17YgfrtMXRW-wF8vRzG26wzAqUM,5439
|
13
|
-
ddeutil/workflow/reusables.py,sha256=hIpehea6J4OWeXX55kjYzo-c9-_Cc0YRwLRRbcaUkZs,17539
|
14
|
-
ddeutil/workflow/scheduler.py,sha256=F783QaJfPg8tvYyvJvkwl8Sa42vsJzj6BzzROZFvm9I,28153
|
15
|
-
ddeutil/workflow/stages.py,sha256=2vO5pdUgKHeGsS762fdYrBkWfvby_Q3Z71ptHajEp8k,55904
|
16
|
-
ddeutil/workflow/utils.py,sha256=CtFUrP_4m6xaJooc9RbE4ulTBE-OkICg-MPHqzCuJ0I,7392
|
17
|
-
ddeutil/workflow/workflow.py,sha256=mCpsAY0Su-pMJ_xZ-qF6lDEXn-Ih7myUODZ0ZEuyVew,50804
|
18
|
-
ddeutil/workflow/api/__init__.py,sha256=F53NMBWtb9IKaDWkPU5KvybGGfKAcbehgn6TLBwHuuM,21
|
19
|
-
ddeutil/workflow/api/api.py,sha256=CWtPLgOv2Jus9E7nzG5mG2Z32ZEkUK3JWQ2htZyMRpA,5244
|
20
|
-
ddeutil/workflow/api/log.py,sha256=NMTnOnsBrDB5129329xF2myLdrb-z9k1MQrmrP7qXJw,1818
|
21
|
-
ddeutil/workflow/api/repeat.py,sha256=uTtUFVLpiYYahXvCVx8sueRQ03K2Xw1id_gW3IMmX1U,5295
|
22
|
-
ddeutil/workflow/api/routes/__init__.py,sha256=qoGtOMyVgQ5nTUc8J8wH27A8isaxl3IFCX8qoyibeCY,484
|
23
|
-
ddeutil/workflow/api/routes/job.py,sha256=oPwBVP0Mxwxv-bGPlfmxQQ9PcVl0ev9HoPzndpYDCCQ,1954
|
24
|
-
ddeutil/workflow/api/routes/logs.py,sha256=U6vOni3wd-ZTOwd3yVdSOpgyRmNdcgfngU5KlLM3Cww,5383
|
25
|
-
ddeutil/workflow/api/routes/schedules.py,sha256=EgUjyRGhsm6UNaMj5luh6TcY6l571sCHcla-BL1iOfY,4829
|
26
|
-
ddeutil/workflow/api/routes/workflows.py,sha256=JcDOrn1deK8ztFRcMTNATQejG6KMA7JxZLVc4QeBsP4,4527
|
27
|
-
ddeutil_workflow-0.0.49.dist-info/licenses/LICENSE,sha256=nGFZ1QEhhhWeMHf9n99_fdt4vQaXS29xWKxt-OcLywk,1085
|
28
|
-
ddeutil_workflow-0.0.49.dist-info/METADATA,sha256=U847vy3oZ6ZEvngEe-9W3wA1vkKGr15UQa73v9Dsy7k,18257
|
29
|
-
ddeutil_workflow-0.0.49.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
30
|
-
ddeutil_workflow-0.0.49.dist-info/top_level.txt,sha256=m9M6XeSWDwt_yMsmH6gcOjHZVK5O0-vgtNBuncHjzW4,8
|
31
|
-
ddeutil_workflow-0.0.49.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|