ddeutil-workflow 0.0.45__py3-none-any.whl → 0.0.46__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 +1 @@
1
- __version__: str = "0.0.45"
1
+ __version__: str = "0.0.46"
File without changes
ddeutil/workflow/conf.py CHANGED
@@ -26,7 +26,10 @@ PREFIX: str = "WORKFLOW"
26
26
 
27
27
 
28
28
  def env(var: str, default: str | None = None) -> str | None: # pragma: no cov
29
- """Get environment variable with uppercase and adding prefix string."""
29
+ """Get environment variable with uppercase and adding prefix string.
30
+
31
+ :rtype: str | None
32
+ """
30
33
  return os.getenv(f"{PREFIX}_{var.upper().replace(' ', '_')}", default)
31
34
 
32
35
 
@@ -42,29 +45,7 @@ __all__: TupleStr = (
42
45
  )
43
46
 
44
47
 
45
- class BaseConfig: # pragma: no cov
46
- """BaseConfig object inheritable."""
47
-
48
- __slots__ = ()
49
-
50
- @property
51
- def root_path(self) -> Path:
52
- """Root path or the project path.
53
-
54
- :rtype: Path
55
- """
56
- return Path(os.getenv("ROOT_PATH", "."))
57
-
58
- @property
59
- def conf_path(self) -> Path:
60
- """Config path that use root_path class argument for this construction.
61
-
62
- :rtype: Path
63
- """
64
- return self.root_path / os.getenv("CONF_PATH", "conf")
65
-
66
-
67
- class Config(BaseConfig): # pragma: no cov
48
+ class Config: # pragma: no cov
68
49
  """Config object for keeping core configurations on the current session
69
50
  without changing when if the application still running.
70
51
 
@@ -217,6 +198,7 @@ class Config(BaseConfig): # pragma: no cov
217
198
 
218
199
 
219
200
  class APIConfig:
201
+ """API Config object."""
220
202
 
221
203
  @property
222
204
  def prefix_path(self) -> str:
ddeutil/workflow/job.py CHANGED
@@ -641,6 +641,9 @@ def local_execute_strategy(
641
641
 
642
642
  for stage in job.stages:
643
643
 
644
+ if job.extras:
645
+ stage.extras = job.extras
646
+
644
647
  if stage.is_skipped(params=context):
645
648
  result.trace.info(f"[STAGE]: Skip stage: {stage.iden!r}")
646
649
  stage.set_outputs(output={"skipped": True}, to=context)
@@ -814,6 +814,8 @@ class CallStage(BaseStage):
814
814
  run_id=gen_id(self.name + (self.id or ""), unique=True)
815
815
  )
816
816
 
817
+ print("Extras in CallStage", self.extras)
818
+
817
819
  t_func: TagFunc = extract_call(
818
820
  param2template(self.uses, params, extras=self.extras),
819
821
  registries=self.extras.get("regis_call"),
@@ -976,6 +978,8 @@ class ParallelStage(BaseStage): # pragma: no cov
976
978
  params: DictData,
977
979
  result: Result,
978
980
  stages: list[Stage],
981
+ *,
982
+ extras: DictData | None = None,
979
983
  ) -> DictData:
980
984
  """Task execution method for passing a branch to each thread.
981
985
 
@@ -984,12 +988,16 @@ class ParallelStage(BaseStage): # pragma: no cov
984
988
  :param result: (Result) A result object for keeping context and status
985
989
  data.
986
990
  :param stages:
991
+ :param extras
987
992
 
988
993
  :rtype: DictData
989
994
  """
990
995
  context = {"branch": branch, "stages": {}}
991
996
  result.trace.debug(f"[STAGE]: Execute parallel branch: {branch!r}")
992
997
  for stage in stages:
998
+ if extras:
999
+ stage.extras = extras
1000
+
993
1001
  try:
994
1002
  stage.set_outputs(
995
1003
  stage.handler_execute(
@@ -1048,6 +1056,7 @@ class ParallelStage(BaseStage): # pragma: no cov
1048
1056
  params=params,
1049
1057
  result=result,
1050
1058
  stages=self.parallel[branch],
1059
+ extras=self.extras,
1051
1060
  )
1052
1061
  )
1053
1062
 
@@ -1144,6 +1153,10 @@ class ForEachStage(BaseStage):
1144
1153
  context = {"stages": {}}
1145
1154
 
1146
1155
  for stage in self.stages:
1156
+
1157
+ if self.extras:
1158
+ stage.extras = self.extras
1159
+
1147
1160
  try:
1148
1161
  stage.set_outputs(
1149
1162
  stage.handler_execute(
@@ -1284,6 +1297,9 @@ class CaseStage(BaseStage): # pragma: no cov
1284
1297
 
1285
1298
  if match == _condition:
1286
1299
  stage: Stage = match.stage
1300
+ if self.extras:
1301
+ stage.extras = self.extras
1302
+
1287
1303
  try:
1288
1304
  stage.set_outputs(
1289
1305
  stage.handler_execute(
@@ -1139,7 +1139,7 @@ class Workflow(BaseModel):
1139
1139
  not_timeout_flag := ((time.monotonic() - ts) < timeout)
1140
1140
  ):
1141
1141
  job_id: str = job_queue.get()
1142
- job: Job = self.jobs[job_id]
1142
+ job: Job = self.job(name=job_id)
1143
1143
 
1144
1144
  if (check := job.check_needs(context["jobs"])) == WAIT:
1145
1145
  job_queue.task_done()
@@ -1231,7 +1231,7 @@ class Workflow(BaseModel):
1231
1231
  not_timeout_flag := ((time.monotonic() - ts) < timeout)
1232
1232
  ):
1233
1233
  job_id: str = job_queue.get()
1234
- job: Job = self.jobs[job_id]
1234
+ job: Job = self.job(name=job_id)
1235
1235
 
1236
1236
  if (check := job.check_needs(context["jobs"])) == WAIT:
1237
1237
  job_queue.task_done()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ddeutil-workflow
3
- Version: 0.0.45
3
+ Version: 0.0.46
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 :: 4 - Beta
12
+ Classifier: Development Status :: 5 - Production/Stable
13
13
  Classifier: Intended Audience :: Developers
14
14
  Classifier: Operating System :: OS Independent
15
15
  Classifier: Programming Language :: Python
@@ -1,19 +1,20 @@
1
- ddeutil/workflow/__about__.py,sha256=SRGMEfbOwgNFzpR_XZJUPWxcNUSIkcCKp1M3mCR6pQk,28
1
+ ddeutil/workflow/__about__.py,sha256=yDFXJ7qonVJ1xTa_rhZ4F9WS1AblaopGDHPdNrytYtM,28
2
2
  ddeutil/workflow/__cron.py,sha256=h8rLeIUAAEB2SdZ4Jhch7LU1Yl3bbJ-iNNJ3tQ0eYVM,28095
3
3
  ddeutil/workflow/__init__.py,sha256=m7ZTCuUOarcTKJuXOyuaXd5WTIO7NTkqCeCrNX3d5i8,1943
4
+ ddeutil/workflow/__main__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
5
  ddeutil/workflow/__types.py,sha256=8jBdbfb3aZSetjz0mvNrpGHwwxJff7mK8_4v41cLqlc,4316
5
- ddeutil/workflow/conf.py,sha256=n8grMRUVMtZFFc0J0g0wwG7JpDbvzpQcLoRehca1Qnk,12519
6
+ ddeutil/workflow/conf.py,sha256=ZlaaLeZuBzqcnS-gfHQV58dJVMwQaRTjWxWZGCzX42s,12068
6
7
  ddeutil/workflow/cron.py,sha256=80SijzMdDOBxTWRsiF-Fmuz7Ym7leY0XT2lzRAPGdXc,8781
7
8
  ddeutil/workflow/exceptions.py,sha256=uLNxzav3HRcr4vaZnvbUIF_eTR6UXXZNaxroMWFOUL4,1418
8
- ddeutil/workflow/job.py,sha256=NgEPgMAUL2mqDctLpdoEVx4g0ZsTj4RmkQluCh_ZUdM,30614
9
+ ddeutil/workflow/job.py,sha256=uDT_lxAmtWDk6OYm6E4_rz_ngMdS5S03YF4D3WZMP8k,30676
9
10
  ddeutil/workflow/logs.py,sha256=Ki1t6HkThwimzAe1OSxPPc7OQ4r-kXAc1kB63x2DsOg,21160
10
11
  ddeutil/workflow/params.py,sha256=xCtFEh0-G-G-f8y_SXxyf31bU6Ox5p5Z-WbBFXrjy8M,9960
11
12
  ddeutil/workflow/result.py,sha256=9tbCmP0Sjy7h9GKWyD5e1bjAzNOWZcnvBFuC6to_f-8,4929
12
13
  ddeutil/workflow/reusables.py,sha256=ZE8WfD0WyQUKRV5aujJpGG6g6ODJz-wtgwHbQiCrN-E,17536
13
14
  ddeutil/workflow/scheduler.py,sha256=_MDsEHbBVOeF-381U8DfIMDyca_nG3XNXmgX4229_EU,27437
14
- ddeutil/workflow/stages.py,sha256=cvSNt4IjbE4O9llCIL2bojnl4W50GHNa1ANQ4oGefUo,47438
15
+ ddeutil/workflow/stages.py,sha256=G9TtXx2_HzcvgOetcncW0-GzMapqho6VmxENFyoYmt0,47829
15
16
  ddeutil/workflow/utils.py,sha256=sblje9qOtejCHVt8EVrbC0KY98vKqvxccaR5HIkRiTA,7363
16
- ddeutil/workflow/workflow.py,sha256=Pkm2e7Edph3l7ITjo3iTtvpbXmKD_fCeq7HrxdV0KAo,49708
17
+ ddeutil/workflow/workflow.py,sha256=kEbPr2Wi9n5fDaCi5R26f4SHw7083_TdcIkZw-w7cEA,49716
17
18
  ddeutil/workflow/api/__init__.py,sha256=F53NMBWtb9IKaDWkPU5KvybGGfKAcbehgn6TLBwHuuM,21
18
19
  ddeutil/workflow/api/api.py,sha256=b-bMg0aRsEqt8Qb2hNUtamEt2Fq2CgNotF2oXSAdDu8,5226
19
20
  ddeutil/workflow/api/log.py,sha256=NMTnOnsBrDB5129329xF2myLdrb-z9k1MQrmrP7qXJw,1818
@@ -23,8 +24,8 @@ ddeutil/workflow/api/routes/job.py,sha256=YVta083i8vU8-o4WdKFwDpfdC9vN1dZ6goZSmN
23
24
  ddeutil/workflow/api/routes/logs.py,sha256=TeRDrEelbKS2Hu_EovgLh0bOdmSv9mfnrIZsrE7uPD4,5353
24
25
  ddeutil/workflow/api/routes/schedules.py,sha256=rUWBm5RgLS1PNBHSWwWXJ0l-c5mYWfl9os0BA9_OTEw,4810
25
26
  ddeutil/workflow/api/routes/workflows.py,sha256=ctgQGxXfpIV6bHFDM9IQ1_qaQHT6n5-HjJ1-D4GKWpc,4527
26
- ddeutil_workflow-0.0.45.dist-info/licenses/LICENSE,sha256=nGFZ1QEhhhWeMHf9n99_fdt4vQaXS29xWKxt-OcLywk,1085
27
- ddeutil_workflow-0.0.45.dist-info/METADATA,sha256=4i4i_79_2HjUuyzyB6LWhP2wEKh3xifSfiDf8o_bENY,19116
28
- ddeutil_workflow-0.0.45.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
29
- ddeutil_workflow-0.0.45.dist-info/top_level.txt,sha256=m9M6XeSWDwt_yMsmH6gcOjHZVK5O0-vgtNBuncHjzW4,8
30
- ddeutil_workflow-0.0.45.dist-info/RECORD,,
27
+ ddeutil_workflow-0.0.46.dist-info/licenses/LICENSE,sha256=nGFZ1QEhhhWeMHf9n99_fdt4vQaXS29xWKxt-OcLywk,1085
28
+ ddeutil_workflow-0.0.46.dist-info/METADATA,sha256=_HZpnC_wIzRdBFhLXDVsJpfPBevg5YXKDYll6KGg4pE,19129
29
+ ddeutil_workflow-0.0.46.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
30
+ ddeutil_workflow-0.0.46.dist-info/top_level.txt,sha256=m9M6XeSWDwt_yMsmH6gcOjHZVK5O0-vgtNBuncHjzW4,8
31
+ ddeutil_workflow-0.0.46.dist-info/RECORD,,