ddeutil-workflow 0.0.76__py3-none-any.whl → 0.0.77__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.76"
1
+ __version__: str = "0.0.77"
ddeutil/workflow/conf.py CHANGED
@@ -322,25 +322,30 @@ class YamlParser:
322
322
  excluded: Optional[list[str]] = None,
323
323
  extras: Optional[DictData] = None,
324
324
  ignore_filename: Optional[str] = None,
325
+ tags: Optional[list[str]] = None,
325
326
  ) -> Iterator[tuple[str, DictData]]:
326
327
  """Find all data that match with object type in config path. This class
327
328
  method can use include and exclude list of identity name for filter and
328
329
  adds-on.
329
330
 
330
- :param obj: (object | str) An object that want to validate matching
331
- before return.
332
- :param path: (Path) A config path object.
333
- :param paths: (list[Path]) A list of config path object.
334
- :param excluded: An included list of data key that want to filter from
335
- data.
336
- :param extras: (DictData) An extra parameter that use to override core
337
- config values.
338
- :param ignore_filename: (str) An ignore filename. Default is
331
+ Args:
332
+ obj: (object | str) An object that want to validate matching
333
+ before return.
334
+ path: (Path) A config path object.
335
+ paths: (list[Path]) A list of config path object.
336
+ excluded: An included list of data key that want to filter from
337
+ data.
338
+ extras: (DictData) An extra parameter that use to override core
339
+ config values.
340
+ ignore_filename: (str) An ignore filename. Default is
339
341
  ``.confignore`` filename.
342
+ tags: (list[str])
343
+ A list of tag that want to filter.
340
344
 
341
345
  :rtype: Iterator[tuple[str, DictData]]
342
346
  """
343
347
  excluded: list[str] = excluded or []
348
+ tags: list[str] = tags or []
344
349
  path: Path = dynamic("conf_path", f=path, extras=extras)
345
350
  paths: Optional[list[Path]] = paths or (extras or {}).get("conf_paths")
346
351
  if not paths:
@@ -366,6 +371,14 @@ class YamlParser:
366
371
  if key in excluded:
367
372
  continue
368
373
 
374
+ if (
375
+ tags
376
+ and (ts := data[key].get("tags"))
377
+ and isinstance(ts, list)
378
+ and all(t not in tags for t in ts)
379
+ ): # pragma: no cov
380
+ continue
381
+
369
382
  if (t := data.get("type")) and t == obj_type:
370
383
  marking: tuple[float, DictData] = (
371
384
  file.lstat().st_mtime,
@@ -469,7 +482,10 @@ def pass_env(value: T) -> T: # pragma: no cov
469
482
  if isinstance(value, dict):
470
483
  return {k: pass_env(value[k]) for k in value}
471
484
  elif isinstance(value, (list, tuple, set)):
472
- return type(value)([pass_env(i) for i in value])
485
+ try:
486
+ return type(value)(pass_env(i) for i in value)
487
+ except TypeError:
488
+ return value
473
489
  if not isinstance(value, str):
474
490
  return value
475
491
 
@@ -421,12 +421,13 @@ def param2template(
421
421
  for k in value
422
422
  }
423
423
  elif isinstance(value, (list, tuple, set)):
424
- return type(value)(
425
- [
424
+ try:
425
+ return type(value)(
426
426
  param2template(i, params, context, filters, extras=extras)
427
427
  for i in value
428
- ]
429
- )
428
+ )
429
+ except TypeError:
430
+ return value
430
431
  elif not isinstance(value, str):
431
432
  return value
432
433
  return str2template(
@@ -329,7 +329,7 @@ class BaseStage(BaseModel, ABC):
329
329
  parent_run_id=parent_run_id,
330
330
  event=event,
331
331
  )
332
- if result_caught.status == WAIT:
332
+ if result_caught.status == WAIT: # pragma: no cov
333
333
  raise StageError(
334
334
  "Status from execution should not return waiting status."
335
335
  )
@@ -656,7 +656,7 @@ class BaseAsyncStage(BaseStage, ABC):
656
656
  parent_run_id=parent_run_id,
657
657
  event=event,
658
658
  )
659
- if result_caught.status == WAIT:
659
+ if result_caught.status == WAIT: # pragma: no cov
660
660
  raise StageError(
661
661
  "Status from execution should not return waiting status."
662
662
  )
ddeutil/workflow/utils.py CHANGED
@@ -271,7 +271,10 @@ def filter_func(value: T) -> T:
271
271
  if isinstance(value, dict):
272
272
  return {k: filter_func(value[k]) for k in value}
273
273
  elif isinstance(value, (list, tuple, set)):
274
- return type(value)([filter_func(i) for i in value])
274
+ try:
275
+ return type(value)(filter_func(i) for i in value)
276
+ except TypeError:
277
+ return value
275
278
 
276
279
  if isfunction(value):
277
280
  # NOTE: If it wants to improve to get this function, it is able to save
@@ -338,7 +341,10 @@ def dump_all(
338
341
  if isinstance(value, dict):
339
342
  return {k: dump_all(value[k], by_alias=by_alias) for k in value}
340
343
  elif isinstance(value, (list, tuple, set)):
341
- return type(value)([dump_all(i, by_alias=by_alias) for i in value])
344
+ try:
345
+ return type(value)(dump_all(i, by_alias=by_alias) for i in value)
346
+ except TypeError:
347
+ return value
342
348
  elif isinstance(value, BaseModel):
343
349
  return value.model_dump(by_alias=by_alias)
344
350
  return value
@@ -152,6 +152,10 @@ class Workflow(BaseModel):
152
152
  default_factory=dict,
153
153
  description="A mapping of job ID and job model that already loaded.",
154
154
  )
155
+ tags: list[str] = Field(
156
+ default_factory=list,
157
+ description="A list of tag that use for simple grouping workflow.",
158
+ )
155
159
  created_at: datetime = Field(
156
160
  default_factory=get_dt_now,
157
161
  description=(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ddeutil-workflow
3
- Version: 0.0.76
3
+ Version: 0.0.77
4
4
  Summary: Lightweight workflow orchestration with YAML template
5
5
  Author-email: ddeutils <korawich.anu@gmail.com>
6
6
  License: MIT
@@ -1,30 +1,30 @@
1
- ddeutil/workflow/__about__.py,sha256=ZWCr4NXnXaxhYuhduVXp9CkXr2m6FgZDruUsw8AdJBM,28
1
+ ddeutil/workflow/__about__.py,sha256=aU8Cs3gP8PwasjEnV2TWve1NsqO6d4yk5KpYOnhSHz0,28
2
2
  ddeutil/workflow/__cron.py,sha256=avOagaHl9xXOmizeRWm13cOrty9Tw0vRjFq-xoEgpAY,29167
3
3
  ddeutil/workflow/__init__.py,sha256=_8sP-CTPOfwsFFhmdwQ2Gp7yY7qJemP7TYsIWgd5jc0,3300
4
4
  ddeutil/workflow/__main__.py,sha256=Qd-f8z2Q2vpiEP2x6PBFsJrpACWDVxFKQk820MhFmHo,59
5
5
  ddeutil/workflow/__types.py,sha256=tA2vsr6mzTSzbWB1sb62c5GgxODlfVRz6FvgLNJtQao,4788
6
6
  ddeutil/workflow/audits.py,sha256=wANG0jEQ7slUSgVZG4JbjlR5PtmF8mHpM9RH-zpYM_g,12679
7
7
  ddeutil/workflow/cli.py,sha256=eAwRZMSEJu-NONc_un0D_1swFlENMjl3C-iXYnyTTPY,7411
8
- ddeutil/workflow/conf.py,sha256=UCw6v2GFD3tA2LRbp7vLifXniey0P5Ef0U9eBPknrWk,16267
8
+ ddeutil/workflow/conf.py,sha256=CL_LFJyrocNCSGN9NwErVAtN_JdetcBqeYIJ9x7e2nE,16796
9
9
  ddeutil/workflow/errors.py,sha256=tHS6ekxBmZ6sIeLaxHHSaMfhVvlWnndfb2-Aq-bL2So,5509
10
10
  ddeutil/workflow/event.py,sha256=siChcBhsu4ejzW1fK0tjHPXQVaSUCSxPYDgDrh6duwo,13676
11
11
  ddeutil/workflow/job.py,sha256=_NOPWPs2FuiMvNE-L6c9mpXEChXmgQ8zmD33ZzqVi0A,44146
12
12
  ddeutil/workflow/params.py,sha256=Cyz142OcvENIZrM7Efc2xuGPmmFBhROifP5ojoaCezg,13658
13
13
  ddeutil/workflow/result.py,sha256=Fz6y6apivLW-94gAxcT42z-mGqWMk6-O3RJ2GGSNUHM,9146
14
- ddeutil/workflow/reusables.py,sha256=q_OA-oifCGIhW_5j6hTZXZk7FBOmDt0xVrtNnscJfNg,23294
15
- ddeutil/workflow/stages.py,sha256=Z6quvhJ5WZPnItd4xOoQyR_KWE2Z6LYWa5d49N0R5D8,121936
14
+ ddeutil/workflow/reusables.py,sha256=3_TV3lpwzqW2lnBJbgt9MkPXk8lFvp2NhYSCdjyOQI8,23338
15
+ ddeutil/workflow/stages.py,sha256=KchpcPSgrkvPHhpF1YYNOclk1nhdpLL-AG1M71G6QV8,121972
16
16
  ddeutil/workflow/traces.py,sha256=0n6Mytp6oeNjOV8lIsFitzZ6TrtuSNVFkUmodBiE_vA,28466
17
- ddeutil/workflow/utils.py,sha256=EXhIuWzOJHvlcoAdyvuDUomGtMTIB59HxOLpj2VJ1bI,10857
18
- ddeutil/workflow/workflow.py,sha256=Yw7xuEIwQ61qhGfElky9AZY_1o_1Gqta4B1x1nwQNJs,41475
17
+ ddeutil/workflow/utils.py,sha256=N8dVsBYOBVXdFOlUETo7zPFefqp3w0XK1940s7k7iOE,10989
18
+ ddeutil/workflow/workflow.py,sha256=iQ9z6eOoj-66w6p8wGu28doQGGnL569BcjI3dTK561o,41616
19
19
  ddeutil/workflow/api/__init__.py,sha256=5DzYL3ngceoRshh5HYCSVWChqNJSiP01E1bEd8XxPi0,4799
20
20
  ddeutil/workflow/api/log_conf.py,sha256=WfS3udDLSyrP-C80lWOvxxmhd_XWKvQPkwDqKblcH3E,1834
21
21
  ddeutil/workflow/api/routes/__init__.py,sha256=JRaJZB0D6mgR17MbZo8yLtdYDtD62AA8MdKlFqhG84M,420
22
22
  ddeutil/workflow/api/routes/job.py,sha256=-lbZ_hS9pEdSy6zeke5qrXEgdNxtQ2w9in7cHuM2Jzs,2536
23
23
  ddeutil/workflow/api/routes/logs.py,sha256=RiZ62eQVMWArPHE3lpan955U4DdLLkethlvSMlwF7Mg,5312
24
24
  ddeutil/workflow/api/routes/workflows.py,sha256=1Mqx4Hft4uJglgJI-Wcw-JzkhomFYZrtP0DnQDBkAFQ,4410
25
- ddeutil_workflow-0.0.76.dist-info/licenses/LICENSE,sha256=nGFZ1QEhhhWeMHf9n99_fdt4vQaXS29xWKxt-OcLywk,1085
26
- ddeutil_workflow-0.0.76.dist-info/METADATA,sha256=zq63qmHeFG1DpJJWKyO5IjA6tMbYQnHNWa8E5OESD5w,15781
27
- ddeutil_workflow-0.0.76.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
28
- ddeutil_workflow-0.0.76.dist-info/entry_points.txt,sha256=qDTpPSauL0ciO6T4iSVt8bJeYrVEkkoEEw_RlGx6Kgk,63
29
- ddeutil_workflow-0.0.76.dist-info/top_level.txt,sha256=m9M6XeSWDwt_yMsmH6gcOjHZVK5O0-vgtNBuncHjzW4,8
30
- ddeutil_workflow-0.0.76.dist-info/RECORD,,
25
+ ddeutil_workflow-0.0.77.dist-info/licenses/LICENSE,sha256=nGFZ1QEhhhWeMHf9n99_fdt4vQaXS29xWKxt-OcLywk,1085
26
+ ddeutil_workflow-0.0.77.dist-info/METADATA,sha256=hplZltt-c1l8T6x2nJidJ-2U79x-6MhS5c5hXws1oGo,15781
27
+ ddeutil_workflow-0.0.77.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
28
+ ddeutil_workflow-0.0.77.dist-info/entry_points.txt,sha256=qDTpPSauL0ciO6T4iSVt8bJeYrVEkkoEEw_RlGx6Kgk,63
29
+ ddeutil_workflow-0.0.77.dist-info/top_level.txt,sha256=m9M6XeSWDwt_yMsmH6gcOjHZVK5O0-vgtNBuncHjzW4,8
30
+ ddeutil_workflow-0.0.77.dist-info/RECORD,,