ddeutil-workflow 0.0.22__tar.gz → 0.0.23__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.
Files changed (65) hide show
  1. {ddeutil_workflow-0.0.22/src/ddeutil_workflow.egg-info → ddeutil_workflow-0.0.23}/PKG-INFO +1 -1
  2. ddeutil_workflow-0.0.23/src/ddeutil/workflow/__about__.py +1 -0
  3. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/src/ddeutil/workflow/__init__.py +9 -8
  4. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/src/ddeutil/workflow/api.py +1 -1
  5. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/src/ddeutil/workflow/job.py +2 -2
  6. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/src/ddeutil/workflow/on.py +3 -3
  7. ddeutil_workflow-0.0.23/src/ddeutil/workflow/params.py +176 -0
  8. ddeutil_workflow-0.0.23/src/ddeutil/workflow/result.py +102 -0
  9. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/src/ddeutil/workflow/route.py +1 -1
  10. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/src/ddeutil/workflow/scheduler.py +38 -26
  11. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/src/ddeutil/workflow/stage.py +1 -1
  12. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/src/ddeutil/workflow/utils.py +4 -241
  13. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/src/ddeutil/workflow/workflow.py +48 -19
  14. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23/src/ddeutil_workflow.egg-info}/PKG-INFO +1 -1
  15. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/src/ddeutil_workflow.egg-info/SOURCES.txt +6 -3
  16. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/tests/test_job_exec_py.py +1 -1
  17. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/tests/test_job_exec_strategy.py +1 -1
  18. ddeutil_workflow-0.0.22/tests/test_utils_params.py → ddeutil_workflow-0.0.23/tests/test_params.py +5 -1
  19. ddeutil_workflow-0.0.22/tests/test_utils_result.py → ddeutil_workflow-0.0.23/tests/test_result.py +1 -1
  20. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/tests/test_scheduler.py +3 -3
  21. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/tests/test_scheduler_tasks.py +0 -19
  22. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/tests/test_stage.py +37 -15
  23. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/tests/test_stage_exec_bash.py +1 -1
  24. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/tests/test_stage_exec_hook.py +1 -1
  25. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/tests/test_stage_exec_py.py +1 -1
  26. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/tests/test_stage_exec_trigger.py +1 -1
  27. ddeutil_workflow-0.0.23/tests/test_workflow.py +254 -0
  28. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/tests/test_workflow_exec.py +1 -1
  29. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/tests/test_workflow_exec_needs.py +1 -1
  30. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/tests/test_workflow_job_exec.py +1 -1
  31. ddeutil_workflow-0.0.23/tests/test_workflow_poke.py +151 -0
  32. ddeutil_workflow-0.0.23/tests/test_workflow_release.py +165 -0
  33. ddeutil_workflow-0.0.23/tests/test_workflow_schedule.py +58 -0
  34. ddeutil_workflow-0.0.23/tests/test_workflow_task_data.py +82 -0
  35. ddeutil_workflow-0.0.22/src/ddeutil/workflow/__about__.py +0 -1
  36. ddeutil_workflow-0.0.22/tests/test_params.py +0 -13
  37. ddeutil_workflow-0.0.22/tests/test_workflow.py +0 -187
  38. ddeutil_workflow-0.0.22/tests/test_workflow_poke.py +0 -67
  39. ddeutil_workflow-0.0.22/tests/test_workflow_release.py +0 -64
  40. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/LICENSE +0 -0
  41. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/README.md +0 -0
  42. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/pyproject.toml +0 -0
  43. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/setup.cfg +0 -0
  44. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/src/ddeutil/workflow/__cron.py +0 -0
  45. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/src/ddeutil/workflow/__types.py +0 -0
  46. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/src/ddeutil/workflow/cli.py +0 -0
  47. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/src/ddeutil/workflow/conf.py +0 -0
  48. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/src/ddeutil/workflow/exceptions.py +0 -0
  49. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/src/ddeutil/workflow/repeat.py +0 -0
  50. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/src/ddeutil_workflow.egg-info/dependency_links.txt +0 -0
  51. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/src/ddeutil_workflow.egg-info/entry_points.txt +0 -0
  52. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/src/ddeutil_workflow.egg-info/requires.txt +0 -0
  53. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/src/ddeutil_workflow.egg-info/top_level.txt +0 -0
  54. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/tests/test__cron.py +0 -0
  55. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/tests/test__regex.py +0 -0
  56. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/tests/test_conf.py +0 -0
  57. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/tests/test_conf_log.py +0 -0
  58. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/tests/test_job.py +0 -0
  59. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/tests/test_job_strategy.py +0 -0
  60. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/tests/test_on.py +0 -0
  61. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/tests/test_utils.py +0 -0
  62. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/tests/test_utils_filter.py +0 -0
  63. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/tests/test_utils_tag.py +0 -0
  64. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/tests/test_utils_template.py +0 -0
  65. {ddeutil_workflow-0.0.22 → ddeutil_workflow-0.0.23}/tests/test_workflow_exec_hook.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ddeutil-workflow
3
- Version: 0.0.22
3
+ Version: 0.0.23
4
4
  Summary: Lightweight workflow orchestration with less dependencies
5
5
  Author-email: ddeutils <korawich.anu@gmail.com>
6
6
  License: MIT
@@ -0,0 +1 @@
1
+ __version__: str = "0.0.23"
@@ -24,9 +24,17 @@ from .on import (
24
24
  YearOn,
25
25
  interval2crontab,
26
26
  )
27
+ from .params import (
28
+ ChoiceParam,
29
+ DatetimeParam,
30
+ IntParam,
31
+ Param,
32
+ StrParam,
33
+ )
34
+ from .result import Result
27
35
  from .scheduler import (
28
36
  Schedule,
29
- ScheduleWorkflow,
37
+ WorkflowSchedule,
30
38
  )
31
39
  from .stage import (
32
40
  BashStage,
@@ -39,16 +47,9 @@ from .stage import (
39
47
  )
40
48
  from .utils import (
41
49
  FILTERS,
42
- ChoiceParam,
43
- DatetimeParam,
44
- DefaultParam,
45
50
  FilterFunc,
46
51
  FilterRegistry,
47
- IntParam,
48
- Param,
49
- Result,
50
52
  ReturnTagFunc,
51
- StrParam,
52
53
  TagFunc,
53
54
  batch,
54
55
  cross_product,
@@ -23,7 +23,7 @@ from pydantic import BaseModel
23
23
  from .__about__ import __version__
24
24
  from .conf import config, get_logger
25
25
  from .repeat import repeat_at, repeat_every
26
- from .scheduler import WorkflowTaskData
26
+ from .workflow import WorkflowTaskData
27
27
 
28
28
  load_dotenv()
29
29
  logger = get_logger("ddeutil.workflow")
@@ -36,9 +36,9 @@ from .exceptions import (
36
36
  StageException,
37
37
  UtilException,
38
38
  )
39
+ from .result import Result
39
40
  from .stage import Stage
40
41
  from .utils import (
41
- Result,
42
42
  cross_product,
43
43
  cut_id,
44
44
  dash2underscore,
@@ -313,7 +313,7 @@ class Job(BaseModel):
313
313
  # VALIDATE: Validate stage id should not duplicate.
314
314
  rs: list[str] = []
315
315
  for stage in value:
316
- name: str = stage.id or stage.name
316
+ name: str = stage.iden
317
317
  if name in rs:
318
318
  raise ValueError(
319
319
  "Stage name in jobs object should not be duplicate."
@@ -61,7 +61,7 @@ def interval2crontab(
61
61
 
62
62
 
63
63
  class On(BaseModel):
64
- """On Model (Schedule)
64
+ """On Pydantic model (Warped crontab object by model).
65
65
 
66
66
  See Also:
67
67
  * ``generate()`` is the main usecase of this schedule object.
@@ -197,8 +197,8 @@ class On(BaseModel):
197
197
 
198
198
 
199
199
  class YearOn(On):
200
- """Implement On Year Schedule Model for limit year matrix that use by some
201
- data schedule tools like AWS Glue.
200
+ """On with enhance Year Pydantic model for limit year matrix that use by
201
+ some data schedule tools like AWS Glue.
202
202
  """
203
203
 
204
204
  model_config = ConfigDict(arbitrary_types_allowed=True)
@@ -0,0 +1,176 @@
1
+ # ------------------------------------------------------------------------------
2
+ # Copyright (c) 2022 Korawich Anuttra. All rights reserved.
3
+ # Licensed under the MIT License. See LICENSE in the project root for
4
+ # license information.
5
+ # ------------------------------------------------------------------------------
6
+ from __future__ import annotations
7
+
8
+ import logging
9
+ from abc import ABC, abstractmethod
10
+ from datetime import date, datetime
11
+ from typing import Any, Literal, Optional, Union
12
+
13
+ from pydantic import BaseModel, Field
14
+
15
+ from .__types import TupleStr
16
+ from .exceptions import ParamValueException
17
+ from .utils import get_dt_now
18
+
19
+ logger = logging.getLogger("ddeutil.workflow")
20
+
21
+ __all__: TupleStr = (
22
+ "ChoiceParam",
23
+ "DatetimeParam",
24
+ "IntParam",
25
+ "Param",
26
+ "StrParam",
27
+ )
28
+
29
+
30
+ class BaseParam(BaseModel, ABC):
31
+ """Base Parameter that use to make any Params Model. The type will dynamic
32
+ with the type field that made from literal string."""
33
+
34
+ desc: Optional[str] = Field(
35
+ default=None, description="A description of parameter providing."
36
+ )
37
+ required: bool = Field(
38
+ default=True,
39
+ description="A require flag that force to pass this parameter value.",
40
+ )
41
+ type: str = Field(description="A type of parameter.")
42
+
43
+ @abstractmethod
44
+ def receive(self, value: Optional[Any] = None) -> Any:
45
+ raise NotImplementedError(
46
+ "Receive value and validate typing before return valid value."
47
+ )
48
+
49
+
50
+ class DefaultParam(BaseParam):
51
+ """Default Parameter that will check default if it required. This model do
52
+ not implement the receive method.
53
+ """
54
+
55
+ required: bool = Field(
56
+ default=False,
57
+ description="A require flag for the default-able parameter value.",
58
+ )
59
+ default: Optional[str] = Field(
60
+ default=None,
61
+ description="A default value if parameter does not pass.",
62
+ )
63
+
64
+ @abstractmethod
65
+ def receive(self, value: Optional[Any] = None) -> Any:
66
+ raise NotImplementedError(
67
+ "Receive value and validate typing before return valid value."
68
+ )
69
+
70
+
71
+ class DatetimeParam(DefaultParam):
72
+ """Datetime parameter."""
73
+
74
+ type: Literal["datetime"] = "datetime"
75
+ default: datetime = Field(default_factory=get_dt_now)
76
+
77
+ def receive(self, value: str | datetime | date | None = None) -> datetime:
78
+ """Receive value that match with datetime. If a input value pass with
79
+ None, it will use default value instead.
80
+
81
+ :param value: A value that want to validate with datetime parameter
82
+ type.
83
+ :rtype: datetime
84
+ """
85
+ if value is None:
86
+ return self.default
87
+
88
+ if isinstance(value, datetime):
89
+ return value
90
+ elif isinstance(value, date):
91
+ return datetime(value.year, value.month, value.day)
92
+ elif not isinstance(value, str):
93
+ raise ParamValueException(
94
+ f"Value that want to convert to datetime does not support for "
95
+ f"type: {type(value)}"
96
+ )
97
+ try:
98
+ return datetime.fromisoformat(value)
99
+ except ValueError:
100
+ raise ParamValueException(
101
+ f"Invalid isoformat string: {value!r}"
102
+ ) from None
103
+
104
+
105
+ class StrParam(DefaultParam):
106
+ """String parameter."""
107
+
108
+ type: Literal["str"] = "str"
109
+
110
+ def receive(self, value: str | None = None) -> str | None:
111
+ """Receive value that match with str.
112
+
113
+ :param value: A value that want to validate with string parameter type.
114
+ :rtype: str | None
115
+ """
116
+ if value is None:
117
+ return self.default
118
+ return str(value)
119
+
120
+
121
+ class IntParam(DefaultParam):
122
+ """Integer parameter."""
123
+
124
+ type: Literal["int"] = "int"
125
+ default: Optional[int] = Field(
126
+ default=None,
127
+ description="A default value if parameter does not pass.",
128
+ )
129
+
130
+ def receive(self, value: int | None = None) -> int | None:
131
+ """Receive value that match with int.
132
+
133
+ :param value: A value that want to validate with integer parameter type.
134
+ :rtype: int | None
135
+ """
136
+ if value is None:
137
+ return self.default
138
+ if not isinstance(value, int):
139
+ try:
140
+ return int(str(value))
141
+ except ValueError as err:
142
+ raise ParamValueException(
143
+ f"Value can not convert to int, {value}, with base 10"
144
+ ) from err
145
+ return value
146
+
147
+
148
+ class ChoiceParam(BaseParam):
149
+ """Choice parameter."""
150
+
151
+ type: Literal["choice"] = "choice"
152
+ options: list[str] = Field(description="A list of choice parameters.")
153
+
154
+ def receive(self, value: str | None = None) -> str:
155
+ """Receive value that match with options.
156
+
157
+ :param value: A value that want to select from the options field.
158
+ :rtype: str
159
+ """
160
+ # NOTE:
161
+ # Return the first value in options if does not pass any input value
162
+ if value is None:
163
+ return self.options[0]
164
+ if value not in self.options:
165
+ raise ParamValueException(
166
+ f"{value!r} does not match any value in choice options."
167
+ )
168
+ return value
169
+
170
+
171
+ Param = Union[
172
+ ChoiceParam,
173
+ DatetimeParam,
174
+ IntParam,
175
+ StrParam,
176
+ ]
@@ -0,0 +1,102 @@
1
+ # ------------------------------------------------------------------------------
2
+ # Copyright (c) 2022 Korawich Anuttra. All rights reserved.
3
+ # Licensed under the MIT License. See LICENSE in the project root for
4
+ # license information.
5
+ # ------------------------------------------------------------------------------
6
+ from __future__ import annotations
7
+
8
+ from dataclasses import field
9
+ from typing import Optional
10
+
11
+ from pydantic.dataclasses import dataclass
12
+ from pydantic.functional_validators import model_validator
13
+ from typing_extensions import Self
14
+
15
+ from .__types import DictData, TupleStr
16
+ from .utils import gen_id
17
+
18
+ __all__: TupleStr = ("Result",)
19
+
20
+
21
+ @dataclass
22
+ class Result:
23
+ """Result Pydantic Model for passing and receiving data context from any
24
+ module execution process like stage execution, job execution, or workflow
25
+ execution.
26
+
27
+ For comparison property, this result will use ``status``, ``context``,
28
+ and ``_run_id`` fields to comparing with other result instance.
29
+ """
30
+
31
+ status: int = field(default=2)
32
+ context: DictData = field(default_factory=dict)
33
+ run_id: Optional[str] = field(default=None)
34
+
35
+ # NOTE: Ignore this field to compare another result model with __eq__.
36
+ parent_run_id: Optional[str] = field(default=None, compare=False)
37
+
38
+ @model_validator(mode="after")
39
+ def __prepare_run_id(self) -> Self:
40
+ """Prepare running ID which use default ID if it initialize at the first
41
+ time
42
+
43
+ :rtype: Self
44
+ """
45
+ self._run_id = gen_id("manual", unique=True)
46
+ return self
47
+
48
+ def set_run_id(self, running_id: str) -> Self:
49
+ """Set a running ID.
50
+
51
+ :param running_id: A running ID that want to update on this model.
52
+ :rtype: Self
53
+ """
54
+ self.run_id = running_id
55
+ return self
56
+
57
+ def set_parent_run_id(self, running_id: str) -> Self:
58
+ """Set a parent running ID.
59
+
60
+ :param running_id: A running ID that want to update on this model.
61
+ :rtype: Self
62
+ """
63
+ self.parent_run_id: str = running_id
64
+ return self
65
+
66
+ def catch(self, status: int, context: DictData) -> Self:
67
+ """Catch the status and context to current data."""
68
+ self.__dict__["status"] = status
69
+ self.__dict__["context"].update(context)
70
+ return self
71
+
72
+ def receive(self, result: Result) -> Self:
73
+ """Receive context from another result object.
74
+
75
+ :rtype: Self
76
+ """
77
+ self.__dict__["status"] = result.status
78
+ self.__dict__["context"].update(result.context)
79
+
80
+ # NOTE: Update running ID from an incoming result.
81
+ self.parent_run_id = result.parent_run_id
82
+ self.run_id = result.run_id
83
+ return self
84
+
85
+ def receive_jobs(self, result: Result) -> Self:
86
+ """Receive context from another result object that use on the workflow
87
+ execution which create a ``jobs`` keys on the context if it do not
88
+ exist.
89
+
90
+ :rtype: Self
91
+ """
92
+ self.__dict__["status"] = result.status
93
+
94
+ # NOTE: Check the context has jobs key.
95
+ if "jobs" not in self.__dict__["context"]:
96
+ self.__dict__["context"]["jobs"] = {}
97
+ self.__dict__["context"]["jobs"].update(result.context)
98
+
99
+ # NOTE: Update running ID from an incoming result.
100
+ self.parent_run_id: str = result.parent_run_id
101
+ self.run_id: str = result.run_id
102
+ return self
@@ -17,8 +17,8 @@ from pydantic import BaseModel
17
17
  from . import Workflow
18
18
  from .__types import DictData
19
19
  from .conf import Loader, config, get_logger
20
+ from .result import Result
20
21
  from .scheduler import Schedule
21
- from .utils import Result
22
22
 
23
23
  logger = get_logger("ddeutil.workflow")
24
24
  workflow = APIRouter(
@@ -70,7 +70,7 @@ logging.getLogger("schedule").setLevel(logging.INFO)
70
70
 
71
71
  __all__: TupleStr = (
72
72
  "Schedule",
73
- "ScheduleWorkflow",
73
+ "WorkflowSchedule",
74
74
  "workflow_task_release",
75
75
  "workflow_monitor",
76
76
  "workflow_control",
@@ -78,25 +78,29 @@ __all__: TupleStr = (
78
78
  )
79
79
 
80
80
 
81
- class ScheduleWorkflow(BaseModel):
82
- """Schedule Workflow Pydantic model that use to keep workflow model for the
83
- Schedule model. it should not use Workflow model directly because on the
81
+ class WorkflowSchedule(BaseModel):
82
+ """Workflow Schedule Pydantic model that use to keep workflow model for
83
+ the Schedule model. it should not use Workflow model directly because on the
84
84
  schedule config it can adjust crontab value that different from the Workflow
85
85
  model.
86
86
  """
87
87
 
88
88
  alias: Optional[str] = Field(
89
89
  default=None,
90
- description="An alias name of workflow.",
90
+ description="An alias name of workflow that use for schedule model.",
91
91
  )
92
92
  name: str = Field(description="A workflow name.")
93
93
  on: list[On] = Field(
94
94
  default_factory=list,
95
- description="An override On instance value.",
95
+ description="An override the list of On object values.",
96
96
  )
97
- params: DictData = Field(
97
+ values: DictData = Field(
98
98
  default_factory=dict,
99
- description="A parameters that want to use in workflow execution.",
99
+ description=(
100
+ "A value that want to pass to the workflow parameters when "
101
+ "calling release method."
102
+ ),
103
+ alias="params",
100
104
  )
101
105
 
102
106
  @model_validator(mode="before")
@@ -105,10 +109,13 @@ class ScheduleWorkflow(BaseModel):
105
109
 
106
110
  :rtype: DictData
107
111
  """
108
- values["name"] = values["name"].replace(" ", "_")
112
+ # VALIDATE: Prepare a workflow name that should not include space.
113
+ if name := values.get("name"):
114
+ values["name"] = name.replace(" ", "_")
109
115
 
116
+ # VALIDATE: Add default the alias field with the name.
110
117
  if not values.get("alias"):
111
- values["alias"] = values["name"]
118
+ values["alias"] = values.get("name")
112
119
 
113
120
  cls.__bypass_on(values)
114
121
  return values
@@ -135,6 +142,7 @@ class ScheduleWorkflow(BaseModel):
135
142
  Loader(n, externals={}).data if isinstance(n, str) else n
136
143
  for n in on
137
144
  ]
145
+
138
146
  return data
139
147
 
140
148
  @field_validator("on", mode="after")
@@ -150,19 +158,20 @@ class ScheduleWorkflow(BaseModel):
150
158
  "The on fields should not contain duplicate on value."
151
159
  )
152
160
 
153
- # WARNING:
154
- # if '* * * * *' in set_ons and len(set_ons) > 1:
155
- # raise ValueError(
156
- # "If it has every minute cronjob on value, it should has only "
157
- # "one value in the on field."
158
- # )
161
+ if len(set_ons) > config.max_on_per_workflow:
162
+ raise ValueError(
163
+ f"The number of the on should not more than "
164
+ f"{config.max_on_per_workflow} crontab."
165
+ )
166
+
159
167
  return value
160
168
 
161
169
 
162
170
  class Schedule(BaseModel):
163
- """Schedule Pydantic Model that use to run with scheduler package. It does
164
- not equal the on value in Workflow model but it use same logic to running
165
- release date with crontab interval.
171
+ """Schedule Pydantic model that use to run with any scheduler package.
172
+
173
+ It does not equal the on value in Workflow model but it use same logic
174
+ to running release date with crontab interval.
166
175
  """
167
176
 
168
177
  desc: Optional[str] = Field(
@@ -171,9 +180,9 @@ class Schedule(BaseModel):
171
180
  "A schedule description that can be string of markdown content."
172
181
  ),
173
182
  )
174
- workflows: list[ScheduleWorkflow] = Field(
183
+ workflows: list[WorkflowSchedule] = Field(
175
184
  default_factory=list,
176
- description="A list of ScheduleWorkflow models.",
185
+ description="A list of WorkflowSchedule models.",
177
186
  )
178
187
 
179
188
  @field_validator("desc", mode="after")
@@ -181,6 +190,7 @@ class Schedule(BaseModel):
181
190
  """Prepare description string that was created on a template.
182
191
 
183
192
  :param value: A description string value that want to dedent.
193
+
184
194
  :rtype: str
185
195
  """
186
196
  return dedent(value)
@@ -224,6 +234,9 @@ class Schedule(BaseModel):
224
234
  """Return the list of WorkflowTaskData object from the specific input
225
235
  datetime that mapping with the on field.
226
236
 
237
+ This task creation need queue to tracking release date already
238
+ mapped or not.
239
+
227
240
  :param start_date: A start date that get from the workflow schedule.
228
241
  :param queue: A mapping of name and list of datetime for queue.
229
242
  :param externals: An external parameters that pass to the Loader object.
@@ -232,22 +245,21 @@ class Schedule(BaseModel):
232
245
  :return: Return the list of WorkflowTaskData object from the specific
233
246
  input datetime that mapping with the on field.
234
247
  """
235
-
236
- # NOTE: Create pair of workflow and on.
237
248
  workflow_tasks: list[WorkflowTaskData] = []
238
249
  extras: DictData = externals or {}
239
250
 
240
251
  for sch_wf in self.workflows:
241
252
 
253
+ # NOTE: Loading workflow model from the name of workflow.
242
254
  wf: Workflow = Workflow.from_loader(sch_wf.name, externals=extras)
243
255
 
244
- # NOTE: Create default list of release datetime.
256
+ # NOTE: Create default list of release datetime by empty list.
245
257
  if sch_wf.alias not in queue:
246
258
  queue[sch_wf.alias]: list[datetime] = []
247
259
 
248
260
  # IMPORTANT: Create the default 'on' value if it does not passing
249
261
  # the on field to the Schedule object.
250
- ons: list[On] = wf.on.copy() if len(sch_wf.on) == 0 else sch_wf.on
262
+ ons: list[On] = sch_wf.on or wf.on.copy()
251
263
 
252
264
  for on in ons:
253
265
 
@@ -263,7 +275,7 @@ class Schedule(BaseModel):
263
275
  alias=sch_wf.alias,
264
276
  workflow=wf,
265
277
  runner=runner,
266
- params=sch_wf.params,
278
+ params=sch_wf.values,
267
279
  ),
268
280
  )
269
281
 
@@ -51,9 +51,9 @@ from typing_extensions import Self
51
51
  from .__types import DictData, DictStr, Re, TupleStr
52
52
  from .conf import config, get_logger
53
53
  from .exceptions import StageException
54
+ from .result import Result
54
55
  from .utils import (
55
56
  Registry,
56
- Result,
57
57
  TagFunc,
58
58
  cut_id,
59
59
  gen_id,