ddeutil-workflow 0.0.46__tar.gz → 0.0.48__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.
- {ddeutil_workflow-0.0.46/src/ddeutil_workflow.egg-info → ddeutil_workflow-0.0.48}/PKG-INFO +27 -27
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/README.md +25 -25
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/pyproject.toml +1 -1
- ddeutil_workflow-0.0.48/src/ddeutil/workflow/__about__.py +1 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/src/ddeutil/workflow/__init__.py +0 -1
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/src/ddeutil/workflow/api/api.py +2 -1
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/src/ddeutil/workflow/api/repeat.py +2 -1
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/src/ddeutil/workflow/api/routes/job.py +1 -1
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/src/ddeutil/workflow/api/routes/schedules.py +2 -1
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/src/ddeutil/workflow/api/routes/workflows.py +2 -2
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/src/ddeutil/workflow/conf.py +34 -39
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/src/ddeutil/workflow/job.py +3 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/src/ddeutil/workflow/logs.py +169 -56
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/src/ddeutil/workflow/result.py +25 -21
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/src/ddeutil/workflow/reusables.py +5 -5
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/src/ddeutil/workflow/scheduler.py +19 -9
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/src/ddeutil/workflow/stages.py +73 -31
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/src/ddeutil/workflow/workflow.py +30 -18
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48/src/ddeutil_workflow.egg-info}/PKG-INFO +27 -27
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/tests/test_reusables_call_tag.py +94 -2
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/tests/test_stage_handler_exec.py +23 -6
- ddeutil_workflow-0.0.46/src/ddeutil/workflow/__about__.py +0 -1
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/LICENSE +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/setup.cfg +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/src/ddeutil/workflow/__cron.py +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/src/ddeutil/workflow/__main__.py +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/src/ddeutil/workflow/__types.py +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/src/ddeutil/workflow/api/__init__.py +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/src/ddeutil/workflow/api/log.py +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/src/ddeutil/workflow/api/routes/__init__.py +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/src/ddeutil/workflow/api/routes/logs.py +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/src/ddeutil/workflow/cron.py +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/src/ddeutil/workflow/exceptions.py +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/src/ddeutil/workflow/params.py +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/src/ddeutil/workflow/utils.py +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/src/ddeutil_workflow.egg-info/SOURCES.txt +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/src/ddeutil_workflow.egg-info/dependency_links.txt +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/src/ddeutil_workflow.egg-info/requires.txt +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/src/ddeutil_workflow.egg-info/top_level.txt +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/tests/test__cron.py +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/tests/test__regex.py +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/tests/test_conf.py +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/tests/test_cron_on.py +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/tests/test_job.py +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/tests/test_job_exec.py +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/tests/test_job_exec_strategy.py +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/tests/test_job_strategy.py +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/tests/test_logs_audit.py +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/tests/test_logs_trace.py +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/tests/test_params.py +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/tests/test_release.py +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/tests/test_release_queue.py +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/tests/test_result.py +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/tests/test_reusables_template.py +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/tests/test_reusables_template_filter.py +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/tests/test_schedule.py +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/tests/test_schedule_pending.py +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/tests/test_schedule_tasks.py +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/tests/test_schedule_workflow.py +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/tests/test_scheduler_control.py +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/tests/test_stage.py +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/tests/test_utils.py +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/tests/test_workflow.py +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/tests/test_workflow_exec.py +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/tests/test_workflow_exec_job.py +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/tests/test_workflow_exec_poke.py +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/tests/test_workflow_exec_release.py +0 -0
- {ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/tests/test_workflow_task.py +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.48
|
4
4
|
Summary: Lightweight workflow orchestration
|
5
5
|
Author-email: ddeutils <korawich.anu@gmail.com>
|
6
6
|
License: MIT
|
@@ -9,7 +9,7 @@ Project-URL: Source Code, https://github.com/ddeutils/ddeutil-workflow/
|
|
9
9
|
Keywords: orchestration,workflow
|
10
10
|
Classifier: Topic :: Utilities
|
11
11
|
Classifier: Natural Language :: English
|
12
|
-
Classifier: Development Status ::
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
13
13
|
Classifier: Intended Audience :: Developers
|
14
14
|
Classifier: Operating System :: OS Independent
|
15
15
|
Classifier: Programming Language :: Python
|
@@ -260,31 +260,31 @@ it will use default value and do not raise any error to you.
|
|
260
260
|
> The config value that you will set on the environment should combine with
|
261
261
|
> prefix, component, and name which is `WORKFLOW_{component}_{name}` (Upper case).
|
262
262
|
|
263
|
-
| Name | Component | Default |
|
264
|
-
|
265
|
-
| **ROOT_PATH** | Core | `.` |
|
266
|
-
| **REGISTRY_CALLER** | Core | `.` |
|
267
|
-
| **REGISTRY_FILTER** | Core | `ddeutil.workflow.templates` |
|
268
|
-
| **CONF_PATH** | Core | `conf` |
|
269
|
-
| **TIMEZONE** | Core | `Asia/Bangkok` |
|
270
|
-
| **STAGE_DEFAULT_ID** | Core | `true` |
|
271
|
-
| **STAGE_RAISE_ERROR** | Core | `false` |
|
272
|
-
| **JOB_DEFAULT_ID** | Core | `false` |
|
273
|
-
| **JOB_RAISE_ERROR** | Core | `true` |
|
274
|
-
| **MAX_CRON_PER_WORKFLOW** | Core | `5` |
|
275
|
-
| **MAX_QUEUE_COMPLETE_HIST** | Core | `16` |
|
276
|
-
| **GENERATE_ID_SIMPLE_MODE** | Core | `true` |
|
277
|
-
| **DEBUG_MODE** | Log | `true` |
|
278
|
-
| **FORMAT** | Log | `%(asctime)s.%(msecs)03d (%(name)-10s, %(process)-5d,%(thread)-5d) [%(levelname)-7s] %(message)-120s (%(filename)s:%(lineno)s)` |
|
279
|
-
| **FORMAT_FILE** | Log | `{datetime} ({process:5d}, {thread:5d}) {message:120s} ({filename}:{lineno})` |
|
280
|
-
| **DATETIME_FORMAT** | Log | `%Y-%m-%d %H:%M:%S` |
|
281
|
-
| **TRACE_PATH** | Log | `./logs` |
|
282
|
-
| **TRACE_ENABLE_WRITE** | Log | `false` |
|
283
|
-
| **AUDIT_PATH** | Log | `./audits` |
|
284
|
-
| **AUDIT_ENABLE_WRITE** | Log | `true` |
|
285
|
-
| **MAX_PROCESS** | App | `2` |
|
286
|
-
| **MAX_SCHEDULE_PER_PROCESS** | App | `100` |
|
287
|
-
| **STOP_BOUNDARY_DELTA** | App | `'{"minutes": 5, "seconds": 20}'` |
|
263
|
+
| Name | Component | Default | Description |
|
264
|
+
|:-----------------------------|:---------:|:--------------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------|
|
265
|
+
| **ROOT_PATH** | Core | `.` | Root path or the project path for this workflow engine. |
|
266
|
+
| **REGISTRY_CALLER** | Core | `.` | List of importable string for the call stage. |
|
267
|
+
| **REGISTRY_FILTER** | Core | `ddeutil.workflow.templates` | List of importable string for the filter template. |
|
268
|
+
| **CONF_PATH** | Core | `conf` | The config path that keep all template `.yaml` files. |
|
269
|
+
| **TIMEZONE** | Core | `Asia/Bangkok` | A Timezone string value that will pass to `ZoneInfo` object. |
|
270
|
+
| **STAGE_DEFAULT_ID** | Core | `true` | A flag that enable default stage ID that use for catch an execution output. |
|
271
|
+
| **STAGE_RAISE_ERROR** | Core | `false` | A flag that all stage raise StageException from stage execution. |
|
272
|
+
| **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. |
|
273
|
+
| **JOB_RAISE_ERROR** | Core | `true` | A flag that all job raise JobException from job strategy execution. |
|
274
|
+
| **MAX_CRON_PER_WORKFLOW** | Core | `5` | |
|
275
|
+
| **MAX_QUEUE_COMPLETE_HIST** | Core | `16` | |
|
276
|
+
| **GENERATE_ID_SIMPLE_MODE** | Core | `true` | A flog that enable generating ID with `md5` algorithm. |
|
277
|
+
| **DEBUG_MODE** | Log | `true` | A flag that enable logging with debug level mode. |
|
278
|
+
| **FORMAT** | Log | `%(asctime)s.%(msecs)03d (%(name)-10s, %(process)-5d,%(thread)-5d) [%(levelname)-7s] %(message)-120s (%(filename)s:%(lineno)s)` | |
|
279
|
+
| **FORMAT_FILE** | Log | `{datetime} ({process:5d}, {thread:5d}) {message:120s} ({filename}:{lineno})` | |
|
280
|
+
| **DATETIME_FORMAT** | Log | `%Y-%m-%d %H:%M:%S` | |
|
281
|
+
| **TRACE_PATH** | Log | `./logs` | The log path of the workflow saving log. |
|
282
|
+
| **TRACE_ENABLE_WRITE** | Log | `false` | |
|
283
|
+
| **AUDIT_PATH** | Log | `./audits` | |
|
284
|
+
| **AUDIT_ENABLE_WRITE** | Log | `true` | A flag that enable logging object saving log to its destination. |
|
285
|
+
| **MAX_PROCESS** | App | `2` | The maximum process worker number that run in scheduler app module. |
|
286
|
+
| **MAX_SCHEDULE_PER_PROCESS** | App | `100` | A schedule per process that run parallel. |
|
287
|
+
| **STOP_BOUNDARY_DELTA** | App | `'{"minutes": 5, "seconds": 20}'` | A time delta value that use to stop scheduler app in json string format. |
|
288
288
|
|
289
289
|
**API Application**:
|
290
290
|
|
@@ -217,31 +217,31 @@ it will use default value and do not raise any error to you.
|
|
217
217
|
> The config value that you will set on the environment should combine with
|
218
218
|
> prefix, component, and name which is `WORKFLOW_{component}_{name}` (Upper case).
|
219
219
|
|
220
|
-
| Name | Component | Default |
|
221
|
-
|
222
|
-
| **ROOT_PATH** | Core | `.` |
|
223
|
-
| **REGISTRY_CALLER** | Core | `.` |
|
224
|
-
| **REGISTRY_FILTER** | Core | `ddeutil.workflow.templates` |
|
225
|
-
| **CONF_PATH** | Core | `conf` |
|
226
|
-
| **TIMEZONE** | Core | `Asia/Bangkok` |
|
227
|
-
| **STAGE_DEFAULT_ID** | Core | `true` |
|
228
|
-
| **STAGE_RAISE_ERROR** | Core | `false` |
|
229
|
-
| **JOB_DEFAULT_ID** | Core | `false` |
|
230
|
-
| **JOB_RAISE_ERROR** | Core | `true` |
|
231
|
-
| **MAX_CRON_PER_WORKFLOW** | Core | `5` |
|
232
|
-
| **MAX_QUEUE_COMPLETE_HIST** | Core | `16` |
|
233
|
-
| **GENERATE_ID_SIMPLE_MODE** | Core | `true` |
|
234
|
-
| **DEBUG_MODE** | Log | `true` |
|
235
|
-
| **FORMAT** | Log | `%(asctime)s.%(msecs)03d (%(name)-10s, %(process)-5d,%(thread)-5d) [%(levelname)-7s] %(message)-120s (%(filename)s:%(lineno)s)` |
|
236
|
-
| **FORMAT_FILE** | Log | `{datetime} ({process:5d}, {thread:5d}) {message:120s} ({filename}:{lineno})` |
|
237
|
-
| **DATETIME_FORMAT** | Log | `%Y-%m-%d %H:%M:%S` |
|
238
|
-
| **TRACE_PATH** | Log | `./logs` |
|
239
|
-
| **TRACE_ENABLE_WRITE** | Log | `false` |
|
240
|
-
| **AUDIT_PATH** | Log | `./audits` |
|
241
|
-
| **AUDIT_ENABLE_WRITE** | Log | `true` |
|
242
|
-
| **MAX_PROCESS** | App | `2` |
|
243
|
-
| **MAX_SCHEDULE_PER_PROCESS** | App | `100` |
|
244
|
-
| **STOP_BOUNDARY_DELTA** | App | `'{"minutes": 5, "seconds": 20}'` |
|
220
|
+
| Name | Component | Default | Description |
|
221
|
+
|:-----------------------------|:---------:|:--------------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------|
|
222
|
+
| **ROOT_PATH** | Core | `.` | Root path or the project path for this workflow engine. |
|
223
|
+
| **REGISTRY_CALLER** | Core | `.` | List of importable string for the call stage. |
|
224
|
+
| **REGISTRY_FILTER** | Core | `ddeutil.workflow.templates` | List of importable string for the filter template. |
|
225
|
+
| **CONF_PATH** | Core | `conf` | The config path that keep all template `.yaml` files. |
|
226
|
+
| **TIMEZONE** | Core | `Asia/Bangkok` | A Timezone string value that will pass to `ZoneInfo` object. |
|
227
|
+
| **STAGE_DEFAULT_ID** | Core | `true` | A flag that enable default stage ID that use for catch an execution output. |
|
228
|
+
| **STAGE_RAISE_ERROR** | Core | `false` | A flag that all stage raise StageException from stage execution. |
|
229
|
+
| **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. |
|
230
|
+
| **JOB_RAISE_ERROR** | Core | `true` | A flag that all job raise JobException from job strategy execution. |
|
231
|
+
| **MAX_CRON_PER_WORKFLOW** | Core | `5` | |
|
232
|
+
| **MAX_QUEUE_COMPLETE_HIST** | Core | `16` | |
|
233
|
+
| **GENERATE_ID_SIMPLE_MODE** | Core | `true` | A flog that enable generating ID with `md5` algorithm. |
|
234
|
+
| **DEBUG_MODE** | Log | `true` | A flag that enable logging with debug level mode. |
|
235
|
+
| **FORMAT** | Log | `%(asctime)s.%(msecs)03d (%(name)-10s, %(process)-5d,%(thread)-5d) [%(levelname)-7s] %(message)-120s (%(filename)s:%(lineno)s)` | |
|
236
|
+
| **FORMAT_FILE** | Log | `{datetime} ({process:5d}, {thread:5d}) {message:120s} ({filename}:{lineno})` | |
|
237
|
+
| **DATETIME_FORMAT** | Log | `%Y-%m-%d %H:%M:%S` | |
|
238
|
+
| **TRACE_PATH** | Log | `./logs` | The log path of the workflow saving log. |
|
239
|
+
| **TRACE_ENABLE_WRITE** | Log | `false` | |
|
240
|
+
| **AUDIT_PATH** | Log | `./audits` | |
|
241
|
+
| **AUDIT_ENABLE_WRITE** | Log | `true` | A flag that enable logging object saving log to its destination. |
|
242
|
+
| **MAX_PROCESS** | App | `2` | The maximum process worker number that run in scheduler app module. |
|
243
|
+
| **MAX_SCHEDULE_PER_PROCESS** | App | `100` | A schedule per process that run parallel. |
|
244
|
+
| **STOP_BOUNDARY_DELTA** | App | `'{"minutes": 5, "seconds": 20}'` | A time delta value that use to stop scheduler app in json string format. |
|
245
245
|
|
246
246
|
**API Application**:
|
247
247
|
|
@@ -12,7 +12,7 @@ keywords = ['orchestration', 'workflow']
|
|
12
12
|
classifiers = [
|
13
13
|
"Topic :: Utilities",
|
14
14
|
"Natural Language :: English",
|
15
|
-
"Development Status ::
|
15
|
+
"Development Status :: 4 - Beta",
|
16
16
|
"Intended Audience :: Developers",
|
17
17
|
"Operating System :: OS Independent",
|
18
18
|
"Programming Language :: Python",
|
@@ -0,0 +1 @@
|
|
1
|
+
__version__: str = "0.0.48"
|
@@ -20,7 +20,8 @@ from fastapi.middleware.gzip import GZipMiddleware
|
|
20
20
|
from fastapi.responses import UJSONResponse
|
21
21
|
|
22
22
|
from ..__about__ import __version__
|
23
|
-
from ..conf import api_config, config
|
23
|
+
from ..conf import api_config, config
|
24
|
+
from ..logs import get_logger
|
24
25
|
from ..scheduler import ReleaseThread, ReleaseThreads
|
25
26
|
from ..workflow import ReleaseQueue, WorkflowTask
|
26
27
|
from .repeat import repeat_at
|
@@ -13,7 +13,8 @@ from functools import wraps
|
|
13
13
|
from starlette.concurrency import run_in_threadpool
|
14
14
|
|
15
15
|
from ..__cron import CronJob
|
16
|
-
from ..conf import config
|
16
|
+
from ..conf import config
|
17
|
+
from ..logs import get_logger
|
17
18
|
|
18
19
|
logger = get_logger("uvicorn.error")
|
19
20
|
|
@@ -12,9 +12,9 @@ from fastapi.responses import UJSONResponse
|
|
12
12
|
from pydantic import BaseModel
|
13
13
|
|
14
14
|
from ...__types import DictData
|
15
|
-
from ...conf import get_logger
|
16
15
|
from ...exceptions import JobException
|
17
16
|
from ...job import Job
|
17
|
+
from ...logs import get_logger
|
18
18
|
from ...result import Result
|
19
19
|
|
20
20
|
logger = get_logger("uvicorn.error")
|
{ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/src/ddeutil/workflow/api/routes/schedules.py
RENAMED
@@ -12,7 +12,8 @@ from fastapi import APIRouter, HTTPException, Request
|
|
12
12
|
from fastapi import status as st
|
13
13
|
from fastapi.responses import UJSONResponse
|
14
14
|
|
15
|
-
from ...conf import config
|
15
|
+
from ...conf import config
|
16
|
+
from ...logs import get_logger
|
16
17
|
from ...scheduler import Schedule
|
17
18
|
|
18
19
|
logger = get_logger("uvicorn.error")
|
{ddeutil_workflow-0.0.46 → ddeutil_workflow-0.0.48}/src/ddeutil/workflow/api/routes/workflows.py
RENAMED
@@ -15,8 +15,8 @@ from fastapi.responses import UJSONResponse
|
|
15
15
|
from pydantic import BaseModel
|
16
16
|
|
17
17
|
from ...__types import DictData
|
18
|
-
from ...conf import Loader
|
19
|
-
from ...logs import Audit, get_audit
|
18
|
+
from ...conf import Loader
|
19
|
+
from ...logs import Audit, get_audit, get_logger
|
20
20
|
from ...result import Result
|
21
21
|
from ...workflow import Workflow
|
22
22
|
|
@@ -6,11 +6,10 @@
|
|
6
6
|
from __future__ import annotations
|
7
7
|
|
8
8
|
import json
|
9
|
-
import logging
|
10
9
|
import os
|
11
10
|
from collections.abc import Iterator
|
12
11
|
from datetime import timedelta
|
13
|
-
from functools import cached_property
|
12
|
+
from functools import cached_property
|
14
13
|
from pathlib import Path
|
15
14
|
from typing import Optional, TypeVar
|
16
15
|
from zoneinfo import ZoneInfo
|
@@ -36,7 +35,6 @@ def env(var: str, default: str | None = None) -> str | None: # pragma: no cov
|
|
36
35
|
__all__: TupleStr = (
|
37
36
|
"api_config",
|
38
37
|
"env",
|
39
|
-
"get_logger",
|
40
38
|
"Config",
|
41
39
|
"SimLoad",
|
42
40
|
"Loader",
|
@@ -55,7 +53,8 @@ class Config: # pragma: no cov
|
|
55
53
|
# NOTE: Core
|
56
54
|
@property
|
57
55
|
def root_path(self) -> Path:
|
58
|
-
"""Root path or the project path
|
56
|
+
"""Root path or the project path for this workflow engine that use for
|
57
|
+
combine with `conf_path` value.
|
59
58
|
|
60
59
|
:rtype: Path
|
61
60
|
"""
|
@@ -63,7 +62,7 @@ class Config: # pragma: no cov
|
|
63
62
|
|
64
63
|
@property
|
65
64
|
def conf_path(self) -> Path:
|
66
|
-
"""Config path that
|
65
|
+
"""Config path that keep all workflow template YAML files.
|
67
66
|
|
68
67
|
:rtype: Path
|
69
68
|
"""
|
@@ -71,6 +70,11 @@ class Config: # pragma: no cov
|
|
71
70
|
|
72
71
|
@property
|
73
72
|
def tz(self) -> ZoneInfo:
|
73
|
+
"""Timezone value that return with the `ZoneInfo` object and use for all
|
74
|
+
datetime object in this workflow engine.
|
75
|
+
|
76
|
+
:rtype: ZoneInfo
|
77
|
+
"""
|
74
78
|
return ZoneInfo(env("CORE_TIMEZONE", "UTC"))
|
75
79
|
|
76
80
|
@property
|
@@ -80,7 +84,8 @@ class Config: # pragma: no cov
|
|
80
84
|
# NOTE: Register
|
81
85
|
@property
|
82
86
|
def regis_call(self) -> list[str]:
|
83
|
-
"""Register Caller
|
87
|
+
"""Register Caller that is a list of importable string for the call
|
88
|
+
stage model can get.
|
84
89
|
|
85
90
|
:rtype: list[str]
|
86
91
|
"""
|
@@ -89,7 +94,8 @@ class Config: # pragma: no cov
|
|
89
94
|
|
90
95
|
@property
|
91
96
|
def regis_filter(self) -> list[str]:
|
92
|
-
"""Register Filter
|
97
|
+
"""Register Filter that is a list of importable string for the filter
|
98
|
+
template.
|
93
99
|
|
94
100
|
:rtype: list[str]
|
95
101
|
"""
|
@@ -222,15 +228,13 @@ class SimLoad:
|
|
222
228
|
:param externals: An external parameters
|
223
229
|
|
224
230
|
Noted:
|
225
|
-
|
226
231
|
The config data should have ``type`` key for modeling validation that
|
227
232
|
make this loader know what is config should to do pass to.
|
228
233
|
|
229
234
|
... <identity-key>:
|
230
235
|
... type: <importable-object>
|
231
|
-
... <key-data>: <value-data>
|
232
|
-
...
|
233
|
-
|
236
|
+
... <key-data-1>: <value-data-1>
|
237
|
+
... <key-data-2>: <value-data-2>
|
234
238
|
"""
|
235
239
|
|
236
240
|
def __init__(
|
@@ -253,7 +257,10 @@ class SimLoad:
|
|
253
257
|
|
254
258
|
# VALIDATE: check the data that reading should not empty.
|
255
259
|
if not self.data:
|
256
|
-
raise ValueError(
|
260
|
+
raise ValueError(
|
261
|
+
f"Config {name!r} does not found on conf path: "
|
262
|
+
f"{self.conf_path}."
|
263
|
+
)
|
257
264
|
|
258
265
|
self.data.update(self.externals)
|
259
266
|
|
@@ -299,10 +306,25 @@ class SimLoad:
|
|
299
306
|
|
300
307
|
@classmethod
|
301
308
|
def is_ignore(cls, file: Path, conf_path: Path) -> bool:
|
309
|
+
"""Check this file was ignored.
|
310
|
+
|
311
|
+
:param file: (Path) A file path that want to check.
|
312
|
+
:param conf_path: (Path) A config path that want to read the config
|
313
|
+
ignore file.
|
314
|
+
|
315
|
+
:rtype: bool
|
316
|
+
"""
|
302
317
|
return is_ignored(file, read_ignore(conf_path / ".confignore"))
|
303
318
|
|
304
319
|
@classmethod
|
305
320
|
def filter_yaml(cls, file: Path, name: str | None = None) -> DictData:
|
321
|
+
"""Read a YAML file context from an input file path and specific name.
|
322
|
+
|
323
|
+
:param file: (Path)
|
324
|
+
:param name: (str)
|
325
|
+
|
326
|
+
:rtype: DictData
|
327
|
+
"""
|
306
328
|
if any(file.suffix.endswith(s) for s in (".yml", ".yaml")):
|
307
329
|
values: DictData = YamlFlResolve(file).read()
|
308
330
|
if values is not None:
|
@@ -388,30 +410,3 @@ class Loader(SimLoad):
|
|
388
410
|
conf_path=dynamic("conf_path", extras=externals),
|
389
411
|
externals=externals,
|
390
412
|
)
|
391
|
-
|
392
|
-
|
393
|
-
@lru_cache
|
394
|
-
def get_logger(name: str):
|
395
|
-
"""Return logger object with an input module name.
|
396
|
-
|
397
|
-
:param name: A module name that want to log.
|
398
|
-
"""
|
399
|
-
logger = logging.getLogger(name)
|
400
|
-
|
401
|
-
# NOTE: Developers using this package can then disable all logging just for
|
402
|
-
# this package by;
|
403
|
-
#
|
404
|
-
# `logging.getLogger('ddeutil.workflow').propagate = False`
|
405
|
-
#
|
406
|
-
logger.addHandler(logging.NullHandler())
|
407
|
-
|
408
|
-
formatter = logging.Formatter(
|
409
|
-
fmt=config.log_format,
|
410
|
-
datefmt=config.log_datetime_format,
|
411
|
-
)
|
412
|
-
stream = logging.StreamHandler()
|
413
|
-
stream.setFormatter(formatter)
|
414
|
-
logger.addHandler(stream)
|
415
|
-
|
416
|
-
logger.setLevel(logging.DEBUG if config.debug else logging.INFO)
|
417
|
-
return logger
|
@@ -570,6 +570,7 @@ class Job(BaseModel):
|
|
570
570
|
run_id=run_id,
|
571
571
|
parent_run_id=parent_run_id,
|
572
572
|
id_logic=(self.id or "not-set"),
|
573
|
+
extras=self.extras,
|
573
574
|
)
|
574
575
|
|
575
576
|
if self.runs_on.type == RunsOnType.LOCAL:
|
@@ -756,6 +757,7 @@ def local_execute(
|
|
756
757
|
run_id=run_id,
|
757
758
|
parent_run_id=parent_run_id,
|
758
759
|
id_logic=(job.id or "not-set"),
|
760
|
+
extras=job.extras,
|
759
761
|
)
|
760
762
|
event: Event = Event() if event is None else event
|
761
763
|
|
@@ -891,6 +893,7 @@ def self_hosted_execute(
|
|
891
893
|
run_id=run_id,
|
892
894
|
parent_run_id=parent_run_id,
|
893
895
|
id_logic=(job.id or "not-set"),
|
896
|
+
extras=job.extras,
|
894
897
|
)
|
895
898
|
|
896
899
|
if event and event.is_set():
|