ddeutil-workflow 0.0.27__py3-none-any.whl → 0.0.29__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.
@@ -1,230 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: ddeutil-workflow
3
- Version: 0.0.27
4
- Summary: Lightweight workflow orchestration with less dependencies
5
- Author-email: ddeutils <korawich.anu@gmail.com>
6
- License: MIT
7
- Project-URL: Homepage, https://github.com/ddeutils/ddeutil-workflow/
8
- Project-URL: Source Code, https://github.com/ddeutils/ddeutil-workflow/
9
- Keywords: orchestration,workflow
10
- Classifier: Topic :: Utilities
11
- Classifier: Natural Language :: English
12
- Classifier: Development Status :: 4 - Beta
13
- Classifier: Intended Audience :: Developers
14
- Classifier: Operating System :: OS Independent
15
- Classifier: Programming Language :: Python
16
- Classifier: Programming Language :: Python :: 3 :: Only
17
- Classifier: Programming Language :: Python :: 3.9
18
- Classifier: Programming Language :: Python :: 3.10
19
- Classifier: Programming Language :: Python :: 3.11
20
- Classifier: Programming Language :: Python :: 3.12
21
- Classifier: Programming Language :: Python :: 3.13
22
- Requires-Python: >=3.9.13
23
- Description-Content-Type: text/markdown
24
- License-File: LICENSE
25
- Requires-Dist: ddeutil>=0.4.3
26
- Requires-Dist: ddeutil-io[toml,yaml]>=0.2.3
27
- Requires-Dist: pydantic==2.10.4
28
- Requires-Dist: python-dotenv==1.0.1
29
- Requires-Dist: schedule<2.0.0,==1.2.2
30
- Provides-Extra: api
31
- Requires-Dist: fastapi<1.0.0,>=0.115.0; extra == "api"
32
-
33
- # Workflow
34
-
35
- [![test](https://github.com/ddeutils/ddeutil-workflow/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/ddeutils/ddeutil-workflow/actions/workflows/tests.yml)
36
- [![codecov](https://codecov.io/gh/ddeutils/ddeutil-workflow/graph/badge.svg?token=3NDPN2I0H9)](https://codecov.io/gh/ddeutils/ddeutil-workflow)
37
- [![pypi version](https://img.shields.io/pypi/v/ddeutil-workflow)](https://pypi.org/project/ddeutil-workflow/)
38
- [![python support version](https://img.shields.io/pypi/pyversions/ddeutil-workflow)](https://pypi.org/project/ddeutil-workflow/)
39
- [![size](https://img.shields.io/github/languages/code-size/ddeutils/ddeutil-workflow)](https://github.com/ddeutils/ddeutil-workflow)
40
- [![gh license](https://img.shields.io/github/license/ddeutils/ddeutil-workflow)](https://github.com/ddeutils/ddeutil-workflow/blob/main/LICENSE)
41
- [![code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
42
-
43
- The **Lightweight workflow orchestration** with less dependencies the was created
44
- for easy to make a simple metadata driven for data workflow orchestration.
45
- It can to use for data operator by a `.yaml` template.
46
-
47
- > [!WARNING]
48
- > This package provide only orchestration workload. That mean you should not
49
- > use the workflow stage to process any large volume data which use lot of compute
50
- > resource. :cold_sweat:
51
-
52
- In my opinion, I think it should not create duplicate workflow codes if I can
53
- write with dynamic input parameters on the one template workflow that just change
54
- the input parameters per use-case instead.
55
- This way I can handle a lot of logical workflows in our orgs with only metadata
56
- configuration. It called **Metadata Driven Data Workflow**.
57
-
58
- **:pushpin: <u>Rules of This Workflow engine</u>**:
59
-
60
- 1. The Minimum frequency unit of scheduling is **1 minute** :warning:
61
- 2. Can not re-run only failed stage and its pending downstream :rotating_light:
62
- 3. All parallel tasks inside workflow engine use Multi-Threading
63
- (Python 3.13 unlock GIL :unlock:)
64
-
65
- > [!NOTE]
66
- > _Disclaimer_: I inspire the dynamic statement from the [**GitHub Action**](https://github.com/features/actions)
67
- > with `.yml` files and all of config file from several data orchestration framework
68
- > tools from my experience on Data Engineer. :grimacing:
69
- >
70
- > Other workflow tools that I interest on them and pick some interested feature
71
- > implement to this package:
72
- >
73
- > - [Google **Workflows**](https://cloud.google.com/workflows)
74
- > - [AWS **Step Functions**](https://aws.amazon.com/step-functions/)
75
-
76
- ## :round_pushpin: Installation
77
-
78
- This project need `ddeutil` and `ddeutil-io` extension namespace packages.
79
- If you want to install this package with application add-ons, you should add
80
- `app` in installation;
81
-
82
- | Usecase | Install Optional | Support |
83
- |----------------|------------------------------------------|--------------------|
84
- | Python | `pip install ddeutil-workflow` | :heavy_check_mark: |
85
- | FastAPI Server | `pip install ddeutil-workflow[api]` | :heavy_check_mark: |
86
-
87
- ## :beers: Usage
88
-
89
- This is examples that use workflow file for running common Data Engineering
90
- use-case.
91
-
92
- > [!IMPORTANT]
93
- > I recommend you to use the `hook` stage for all actions that you want to do
94
- > with workflow activity that you want to orchestrate. Because it able to dynamic
95
- > an input argument with the same hook function that make you use less time to
96
- > maintenance your data workflows.
97
-
98
- ```yaml
99
- run-py-local:
100
-
101
- # Validate model that use to parsing exists for template file
102
- type: Workflow
103
- on:
104
- # If workflow deploy to schedule, it will running every 5 minutes
105
- # with Asia/Bangkok timezone.
106
- - cronjob: '*/5 * * * *'
107
- timezone: "Asia/Bangkok"
108
- params:
109
- # Incoming execution parameters will validate with this type. It allow
110
- # to set default value or templating.
111
- source-extract: str
112
- run-date: datetime
113
- jobs:
114
- getting-api-data:
115
- stages:
116
- - name: "Retrieve API Data"
117
- id: retrieve-api
118
- uses: tasks/get-api-with-oauth-to-s3@requests
119
- with:
120
- # Arguments of source data that want to retrieve.
121
- method: post
122
- url: https://finances/open-data/currency-pairs/
123
- body:
124
- resource: ${{ params.source-extract }}
125
-
126
- # You can able to use filtering like Jinja template but this
127
- # package does not use it.
128
- filter: ${{ params.run-date | fmt(fmt='%Y%m%d') }}
129
- auth:
130
- type: bearer
131
- keys: ${API_ACCESS_REFRESH_TOKEN}
132
-
133
- # Arguments of target data that want to landing.
134
- writing_mode: flatten
135
- aws_s3_path: my-data/open-data/${{ params.source-extract }}
136
-
137
- # This Authentication code should implement with your custom hook
138
- # function. The template allow you to use environment variable.
139
- aws_access_client_id: ${AWS_ACCESS_CLIENT_ID}
140
- aws_access_client_secret: ${AWS_ACCESS_CLIENT_SECRET}
141
- ```
142
-
143
- The above workflow template is main executor pipeline that you want to do. If you
144
- want to schedule this workflow, you want to dynamic its parameters change base on
145
- execution time such as `run-date` should change base on that workflow running date.
146
-
147
- So, this package provide the `Schedule` template for this action.
148
-
149
- ```yaml
150
- schedule-run-local-wf:
151
-
152
- # Validate model that use to parsing exists for template file
153
- type: Schedule
154
- workflows:
155
-
156
- # Map existing workflow that want to deploy with scheduler application.
157
- # It allow you to passing release parameter that dynamic change depend the
158
- # current context of this scheduler application releasing that time.
159
- - name: run-py-local
160
- params:
161
- source-extract: "USD-THB"
162
- asat-dt: "${{ release.logical_date }}"
163
- ```
164
-
165
- ## :cookie: Configuration
166
-
167
- The main configuration that use to dynamic changing with your propose of this
168
- application. If any configuration values do not set yet, it will use default value
169
- and do not raise any error to you.
170
-
171
- | Environment | Component | Default | Description | Remark |
172
- |:-------------------------------------------|:---------:|:----------------------------------|:-------------------------------------------------------------------------------------------------------------------|--------|
173
- | **WORKFLOW_ROOT_PATH** | Core | `.` | The root path of the workflow application. | |
174
- | **WORKFLOW_CORE_REGISTRY** | Core | `src` | List of importable string for the hook stage. | |
175
- | **WORKFLOW_CORE_REGISTRY_FILTER** | Core | `ddeutil.workflow.utils` | List of importable string for the filter template. | |
176
- | **WORKFLOW_CORE_PATH_CONF** | Core | `conf` | The config path that keep all template `.yaml` files. | |
177
- | **WORKFLOW_CORE_TIMEZONE** | Core | `Asia/Bangkok` | A Timezone string value that will pass to `ZoneInfo` object. | |
178
- | **WORKFLOW_CORE_STAGE_DEFAULT_ID** | Core | `true` | A flag that enable default stage ID that use for catch an execution output. | |
179
- | **WORKFLOW_CORE_STAGE_RAISE_ERROR** | Core | `false` | A flag that all stage raise StageException from stage execution. | |
180
- | **WORKFLOW_CORE_JOB_DEFAULT_ID** | Core | `false` | A flag that enable default job ID that use for catch an execution output. The ID that use will be sequence number. | |
181
- | **WORKFLOW_CORE_JOB_RAISE_ERROR** | Core | `true` | A flag that all job raise JobException from job strategy execution. | |
182
- | **WORKFLOW_CORE_MAX_NUM_POKING** | Core | `4` | . | |
183
- | **WORKFLOW_CORE_MAX_JOB_PARALLEL** | Core | `2` | The maximum job number that able to run parallel in workflow executor. | |
184
- | **WORKFLOW_CORE_MAX_JOB_EXEC_TIMEOUT** | Core | `600` | | |
185
- | **WORKFLOW_CORE_MAX_CRON_PER_WORKFLOW** | Core | `5` | | |
186
- | **WORKFLOW_CORE_MAX_QUEUE_COMPLETE_HIST** | Core | `16` | | |
187
- | **WORKFLOW_CORE_GENERATE_ID_SIMPLE_MODE** | Core | `true` | A flog that enable generating ID with `md5` algorithm. | |
188
- | **WORKFLOW_LOG_PATH** | Log | `./logs` | The log path of the workflow saving log. | |
189
- | **WORKFLOW_LOG_DEBUG_MODE** | Log | `true` | A flag that enable logging with debug level mode. | |
190
- | **WORKFLOW_LOG_ENABLE_WRITE** | Log | `true` | A flag that enable logging object saving log to its destination. | |
191
- | **WORKFLOW_APP_MAX_PROCESS** | Schedule | `2` | The maximum process worker number that run in scheduler app module. | |
192
- | **WORKFLOW_APP_MAX_SCHEDULE_PER_PROCESS** | Schedule | `100` | A schedule per process that run parallel. | |
193
- | **WORKFLOW_APP_STOP_BOUNDARY_DELTA** | Schedule | `'{"minutes": 5, "seconds": 20}'` | A time delta value that use to stop scheduler app in json string format. | |
194
-
195
- **API Application**:
196
-
197
- | Environment | Component | Default | Description | Remark |
198
- |:----------------------------------------|:-----------:|---------|------------------------------------------------------------------------------------|--------|
199
- | **WORKFLOW_API_ENABLE_ROUTE_WORKFLOW** | API | `true` | A flag that enable workflow route to manage execute manually and workflow logging. | |
200
- | **WORKFLOW_API_ENABLE_ROUTE_SCHEDULE** | API | `true` | A flag that enable run scheduler. | |
201
-
202
- ## :rocket: Deployment
203
-
204
- This package able to run as a application service for receive manual trigger
205
- from the master node via RestAPI or use to be Scheduler background service
206
- like crontab job but via Python API.
207
-
208
- ### API Server
209
-
210
- ```shell
211
- (venv) $ uvicorn src.ddeutil.workflow.api:app --host 127.0.0.1 --port 80
212
- ```
213
-
214
- > [!NOTE]
215
- > If this package already deploy, it able to use multiprocess;
216
- > `uvicorn ddeutil.workflow.api:app --host 127.0.0.1 --port 80 --workers 4`
217
-
218
- ### Docker Container
219
-
220
- Create Docker image;
221
-
222
- ```shell
223
- $ docker build -t ddeutil-workflow:latest -f .container/Dockerfile .
224
- ```
225
-
226
- Run the above Docker image;
227
-
228
- ```shell
229
- $ docker run -i ddeutil-workflow:latest
230
- ```
@@ -1,25 +0,0 @@
1
- ddeutil/workflow/__about__.py,sha256=Tb1KYKrlWsfQNnf5zwGCHzEkcwD78iHOrO3PQIyUgTY,28
2
- ddeutil/workflow/__cron.py,sha256=uA8XcbY_GwA9rJSHaHUaXaJyGDObJN0ZeYlJSinL8y8,26880
3
- ddeutil/workflow/__init__.py,sha256=ATYXzGtLyq4LWCtJ-Odz36QSrLL7dKymVs8ziThOVOk,1582
4
- ddeutil/workflow/__types.py,sha256=Ia7f38kvL3NibwmRKi0wQ1ud_45Z-SojYGhNJwIqcu8,3713
5
- ddeutil/workflow/conf.py,sha256=jr7KPnt3vd7icuXTLGcJt_kT9tlmN1Cu5QBDMHUrm94,16819
6
- ddeutil/workflow/cron.py,sha256=75A0hqevvouziKoLALncLJspVAeki9qCH3zniAJaxzY,7513
7
- ddeutil/workflow/exceptions.py,sha256=NqnQJP52S59XIYMeXbTDbr4xH2UZ5EA3ejpU5Z4g6cQ,894
8
- ddeutil/workflow/hook.py,sha256=yXhpr9E6ZzPb9_9ed79rWiRWDLnwkbRRg3TPmLvqoEI,4899
9
- ddeutil/workflow/job.py,sha256=JJ4vSpuhQnY7LOMf9xq6N8pBZQ1oAxqYQFbKHn_HjdQ,24237
10
- ddeutil/workflow/params.py,sha256=uPGkZx18E-iZ8BteqQ2ONgg0frhF3ZmP5cOyfK2j59U,5280
11
- ddeutil/workflow/result.py,sha256=WIC8MsnfLiWNpZomT6jS4YCdYhlbIVVBjtGGe2dkoKk,3404
12
- ddeutil/workflow/scheduler.py,sha256=BbY_3Y3QOdNwDfdvnRa7grGC2_a0Hn1KJbZKAscchk8,20454
13
- ddeutil/workflow/stage.py,sha256=JJDuObNzpw803-bECmDzeGuaxQW2DnR0Ps8Tl0uJZnw,25033
14
- ddeutil/workflow/templates.py,sha256=X-s5IZjwYpSD7UY3jaQiqbQBBG_Z3cWJDkzEIpicldg,10797
15
- ddeutil/workflow/utils.py,sha256=jg0ZsbglrrF3bAakQ3rSna9KTMq2Qf_NPLnlORHf3J0,6039
16
- ddeutil/workflow/workflow.py,sha256=QoSljQakGcumrx8l-W9yWuQZUTCrhArwAYktsj_L_9s,42204
17
- ddeutil/workflow/api/__init__.py,sha256=F53NMBWtb9IKaDWkPU5KvybGGfKAcbehgn6TLBwHuuM,21
18
- ddeutil/workflow/api/api.py,sha256=Md1cz3Edc7_uz63s_L_i-R3IE4mkO3aTADrX8GOGU-Y,5644
19
- ddeutil/workflow/api/repeat.py,sha256=zyvsrXKk-3-_N8ZRZSki0Mueshugum2jtqctEOp9QSc,4927
20
- ddeutil/workflow/api/route.py,sha256=v96jNbgjM1cJ2MpVSRWs2kgRqF8DQElEBdRZrVFEpEw,8578
21
- ddeutil_workflow-0.0.27.dist-info/LICENSE,sha256=nGFZ1QEhhhWeMHf9n99_fdt4vQaXS29xWKxt-OcLywk,1085
22
- ddeutil_workflow-0.0.27.dist-info/METADATA,sha256=SC2dWZTZ0eruriXwbnhuCHhOg-0Z6wT1t026hJvsLnw,13921
23
- ddeutil_workflow-0.0.27.dist-info/WHEEL,sha256=A3WOREP4zgxI0fKrHUG8DC8013e3dK3n7a6HDbcEIwE,91
24
- ddeutil_workflow-0.0.27.dist-info/top_level.txt,sha256=m9M6XeSWDwt_yMsmH6gcOjHZVK5O0-vgtNBuncHjzW4,8
25
- ddeutil_workflow-0.0.27.dist-info/RECORD,,