dv-flow-mgr 0.0.2.14182043984a1__py3-none-any.whl → 1.0.0.14370600369a1__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.
- dv_flow/mgr/__init__.py +2 -1
- dv_flow/mgr/cmds/cmd_graph.py +2 -3
- dv_flow/mgr/cmds/cmd_run.py +7 -9
- dv_flow/mgr/cmds/cmd_show.py +1 -2
- dv_flow/mgr/cond_def.py +16 -0
- dv_flow/mgr/config.py +7 -0
- dv_flow/mgr/config_def.py +33 -0
- dv_flow/mgr/exec_callable.py +88 -0
- dv_flow/mgr/{pkg_rgy.py → ext_rgy.py} +44 -35
- dv_flow/mgr/extend_def.py +21 -0
- dv_flow/mgr/fragment_def.py +4 -3
- dv_flow/mgr/need_def.py +6 -0
- dv_flow/mgr/null_callable.py +10 -0
- dv_flow/mgr/package.py +30 -6
- dv_flow/mgr/package_def.py +40 -444
- dv_flow/mgr/package_loader.py +701 -0
- dv_flow/mgr/param_def.py +2 -1
- dv_flow/mgr/parser.out +567 -0
- dv_flow/mgr/pytask_callable.py +25 -0
- dv_flow/mgr/root_package.py +9 -0
- dv_flow/mgr/shell_callable.py +14 -0
- dv_flow/mgr/srcinfo.py +15 -0
- dv_flow/mgr/std/flow.dv +25 -4
- dv_flow/mgr/task.py +68 -0
- dv_flow/mgr/task_def.py +36 -24
- dv_flow/mgr/task_graph_builder.py +497 -247
- dv_flow/mgr/task_listener_log.py +4 -0
- dv_flow/mgr/task_node_ctor.py +11 -3
- dv_flow/mgr/task_node_ctor_compound.py +21 -33
- dv_flow/mgr/task_node_leaf.py +25 -3
- dv_flow/mgr/task_params_ctor.py +0 -1
- dv_flow/mgr/task_run_ctxt.py +4 -0
- dv_flow/mgr/task_runner.py +2 -0
- dv_flow/mgr/util/cmds/cmd_schema.py +0 -2
- dv_flow/mgr/util/util.py +4 -3
- dv_flow/mgr/yaml_srcinfo_loader.py +55 -0
- {dv_flow_mgr-0.0.2.14182043984a1.dist-info → dv_flow_mgr-1.0.0.14370600369a1.dist-info}/METADATA +1 -1
- dv_flow_mgr-1.0.0.14370600369a1.dist-info/RECORD +74 -0
- dv_flow_mgr-0.0.2.14182043984a1.dist-info/RECORD +0 -59
- {dv_flow_mgr-0.0.2.14182043984a1.dist-info → dv_flow_mgr-1.0.0.14370600369a1.dist-info}/WHEEL +0 -0
- {dv_flow_mgr-0.0.2.14182043984a1.dist-info → dv_flow_mgr-1.0.0.14370600369a1.dist-info}/entry_points.txt +0 -0
- {dv_flow_mgr-0.0.2.14182043984a1.dist-info → dv_flow_mgr-1.0.0.14370600369a1.dist-info}/licenses/LICENSE +0 -0
- {dv_flow_mgr-0.0.2.14182043984a1.dist-info → dv_flow_mgr-1.0.0.14370600369a1.dist-info}/top_level.txt +0 -0
dv_flow/mgr/std/flow.dv
CHANGED
@@ -28,7 +28,8 @@ package:
|
|
28
28
|
|
29
29
|
tasks:
|
30
30
|
- name: Message
|
31
|
-
|
31
|
+
shell: pytask
|
32
|
+
run: dv_flow.mgr.std.message.Message
|
32
33
|
with:
|
33
34
|
msg:
|
34
35
|
type: str
|
@@ -36,7 +37,8 @@ package:
|
|
36
37
|
- name: FileSet
|
37
38
|
doc: |
|
38
39
|
Creates a fileset from a list of files or glob patterns
|
39
|
-
|
40
|
+
shell: pytask
|
41
|
+
run: dv_flow.mgr.std.fileset.FileSet
|
40
42
|
passthrough: all
|
41
43
|
consumes: none
|
42
44
|
with:
|
@@ -61,7 +63,8 @@ package:
|
|
61
63
|
type: str
|
62
64
|
value: ""
|
63
65
|
- name: CreateFile
|
64
|
-
|
66
|
+
shell: pytask
|
67
|
+
run: dv_flow.mgr.std.create_file.CreateFile
|
65
68
|
passthrough: all
|
66
69
|
consumes: none
|
67
70
|
doc: |
|
@@ -78,7 +81,8 @@ package:
|
|
78
81
|
content:
|
79
82
|
type: str
|
80
83
|
- name: Exec
|
81
|
-
|
84
|
+
shell: pytask
|
85
|
+
run: dv_flow.mgr.std.exec.Exec
|
82
86
|
desc: Executes a subprocess
|
83
87
|
with:
|
84
88
|
shell:
|
@@ -105,6 +109,23 @@ package:
|
|
105
109
|
Optional timestamp file to determine if running
|
106
110
|
the command changed the output
|
107
111
|
types:
|
112
|
+
- name: DataItem
|
113
|
+
with:
|
114
|
+
- name: type
|
115
|
+
type: str
|
116
|
+
- name: FileSet
|
117
|
+
uses: std.DataItem
|
118
|
+
with:
|
119
|
+
- name: filetype
|
120
|
+
type: str
|
121
|
+
value: "FileSet"
|
122
|
+
- name: basedir
|
123
|
+
type: str
|
124
|
+
- name: files
|
125
|
+
type: list
|
126
|
+
item:
|
127
|
+
type: str
|
128
|
+
|
108
129
|
# - name: TaskDataItem
|
109
130
|
# doc: |
|
110
131
|
# Base type for a data element produced by a task.
|
dv_flow/mgr/task.py
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
import dataclasses as dc
|
2
|
+
from typing import Any, Dict, List, Tuple, Union
|
3
|
+
from .srcinfo import SrcInfo
|
4
|
+
from .task_def import TaskDef, RundirE, PassthroughE, ConsumesE
|
5
|
+
from .task_node_ctor import TaskNodeCtor
|
6
|
+
|
7
|
+
@dc.dataclass
|
8
|
+
class Need(object):
|
9
|
+
task : 'Task'
|
10
|
+
cond : str = None
|
11
|
+
|
12
|
+
@dc.dataclass
|
13
|
+
class Task(object):
|
14
|
+
"""
|
15
|
+
Type information about a task, linking it into the package
|
16
|
+
to which it belongs.
|
17
|
+
|
18
|
+
Needs in the Task class point to the resolved name. Overrides
|
19
|
+
are applied when constructing a TaskNode DAG from tasks
|
20
|
+
"""
|
21
|
+
name : str
|
22
|
+
desc: str = ""
|
23
|
+
doc : str = ""
|
24
|
+
paramT : Any = None
|
25
|
+
uses : 'Task' = None
|
26
|
+
needs : List[str] = dc.field(default_factory=list)
|
27
|
+
consumes : Union[ConsumesE, List[Dict[str, Any]]] = dc.field(default=None)
|
28
|
+
passthrough : Union[PassthroughE, List[Dict[str, Any]]] = dc.field(default=None)
|
29
|
+
rundir : RundirE = None
|
30
|
+
# TODO: strategy / matrix
|
31
|
+
subtasks : List['Task'] = dc.field(default_factory=list)
|
32
|
+
run : str = None
|
33
|
+
shell : str = "bash"
|
34
|
+
srcinfo : SrcInfo = None
|
35
|
+
|
36
|
+
@property
|
37
|
+
def leafname(self):
|
38
|
+
return self.name[self.name.rfind(".")+1:]
|
39
|
+
|
40
|
+
def __post_init__(self):
|
41
|
+
if self.name is None:
|
42
|
+
self.name = self.task_def.name
|
43
|
+
|
44
|
+
def dump(self):
|
45
|
+
task = {
|
46
|
+
"name": self.name,
|
47
|
+
"paramT": str(type(self.paramT)),
|
48
|
+
"rundir": str(self.rundir),
|
49
|
+
}
|
50
|
+
|
51
|
+
if self.uses is not None:
|
52
|
+
task["uses"] = self.uses.name
|
53
|
+
if self.needs is not None and len(self.needs):
|
54
|
+
task["needs"] = [n.name for n in self.needs]
|
55
|
+
if self.subtasks is not None and len(self.subtasks):
|
56
|
+
task["subtasks"] = [t.dump() for t in self.subtasks]
|
57
|
+
if self.run is not None:
|
58
|
+
task["run"] = self.run
|
59
|
+
if self.shell is not None:
|
60
|
+
task["shell"] = self.shell
|
61
|
+
if self.srcinfo is not None:
|
62
|
+
task["srcinfo"] = self.srcinfo.dump()
|
63
|
+
|
64
|
+
return task
|
65
|
+
|
66
|
+
def __hash__(self):
|
67
|
+
return id(self)
|
68
|
+
|
dv_flow/mgr/task_def.py
CHANGED
@@ -22,9 +22,10 @@
|
|
22
22
|
import pydantic
|
23
23
|
import pydantic.dataclasses as dc
|
24
24
|
import enum
|
25
|
-
from pydantic import BaseModel
|
25
|
+
from pydantic import BaseModel, ConfigDict
|
26
26
|
from typing import Any, Dict, List, Union, Tuple
|
27
27
|
from .param_def import ParamDef
|
28
|
+
from .srcinfo import SrcInfo
|
28
29
|
from .task_output import TaskOutput
|
29
30
|
|
30
31
|
@dc.dataclass
|
@@ -55,16 +56,27 @@ class StrategyDef(BaseModel):
|
|
55
56
|
default=None,
|
56
57
|
description="Matrix of parameter values to explore")
|
57
58
|
|
58
|
-
class
|
59
|
+
class TaskBodyDef(BaseModel):
|
60
|
+
model_config = ConfigDict(extra='forbid')
|
59
61
|
pytask : Union[str, None] = dc.Field(
|
60
62
|
default=None,
|
61
63
|
description="Python method to execute to implement this task")
|
62
|
-
|
64
|
+
tasks: Union[List['TaskDef'],None] = dc.Field(
|
65
|
+
default_factory=list,
|
66
|
+
description="Sub-tasks")
|
67
|
+
shell: Union[str, None] = dc.Field(
|
63
68
|
default=None,
|
64
|
-
description="
|
69
|
+
description="Specifies the shell to run")
|
70
|
+
run: str = dc.Field(
|
71
|
+
default=None,
|
72
|
+
description="Shell command to execute for this task")
|
73
|
+
# pydep : Union[str, None] = dc.Field(
|
74
|
+
# default=None,
|
75
|
+
# description="Python method to check up-to-date status for this task")
|
65
76
|
|
66
77
|
class TasksBuilder(BaseModel):
|
67
78
|
# TODO: control how much data this task is provided?
|
79
|
+
srcinfo : SrcInfo = dc.Field(default=None)
|
68
80
|
pydef : Union[str, None] = dc.Field(
|
69
81
|
default=None,
|
70
82
|
description="Python method to build the subgraph")
|
@@ -76,23 +88,34 @@ class Tasks(BaseModel):
|
|
76
88
|
|
77
89
|
class TaskDef(BaseModel):
|
78
90
|
"""Holds definition information (ie the YAML view) for a task"""
|
79
|
-
name : str = dc.Field(
|
91
|
+
name : Union[str, None] = dc.Field(
|
80
92
|
title="Task Name",
|
81
|
-
description="The name of the task"
|
82
|
-
|
83
|
-
|
93
|
+
description="The name of the task",
|
94
|
+
default=None)
|
95
|
+
override : Union[str, None] = dc.Field(
|
96
|
+
title="Overide Name",
|
97
|
+
description="The name of the task to override",
|
98
|
+
default=None)
|
84
99
|
uses : str = dc.Field(
|
85
100
|
default=None,
|
86
101
|
title="Base type",
|
87
102
|
description="Task from which this task is derived")
|
103
|
+
body: List['TaskDef'] = dc.Field(
|
104
|
+
default_factory=list,
|
105
|
+
description="Sub-tasks")
|
88
106
|
pytask : str = dc.Field(
|
89
107
|
default=None,
|
90
|
-
|
91
|
-
|
108
|
+
description="Python-based implementation (deprecated)")
|
109
|
+
run : str = dc.Field(
|
110
|
+
default=None,
|
111
|
+
description="Shell-based implementation")
|
112
|
+
shell: str = dc.Field(
|
113
|
+
default="bash",
|
114
|
+
description="Shell to use for shell-based implementation")
|
92
115
|
strategy : StrategyDef = dc.Field(
|
93
116
|
default=None)
|
94
|
-
tasks: Union[List['TaskDef'], TasksBuilder] = dc.Field(
|
95
|
-
|
117
|
+
tasks: Union[List['TaskDef'], TasksBuilder, None] = dc.Field(
|
118
|
+
default=None,
|
96
119
|
description="Sub-tasks")
|
97
120
|
desc : str = dc.Field(
|
98
121
|
default="",
|
@@ -102,7 +125,6 @@ class TaskDef(BaseModel):
|
|
102
125
|
default="",
|
103
126
|
title="Task documentation",
|
104
127
|
description="Full documentation of the task")
|
105
|
-
# needs : List[Union[str,NeedSpec,TaskSpec]] = dc.Field(
|
106
128
|
needs : List[Union[str]] = dc.Field(
|
107
129
|
default_factory=list,
|
108
130
|
description="List of tasks that this task depends on")
|
@@ -119,18 +141,8 @@ class TaskDef(BaseModel):
|
|
119
141
|
consumes : Union[ConsumesE, List[Any], None] = dc.Field(
|
120
142
|
default=None,
|
121
143
|
description="Specifies matching patterns for parameter sets that this task consumes")
|
144
|
+
srcinfo : SrcInfo = dc.Field(default=None)
|
122
145
|
|
123
|
-
def __init__(self, **data):
|
124
|
-
# print("--> task_def %s" % str(data))
|
125
|
-
super().__init__(**data)
|
126
|
-
# print("<-- task_def %s" % str(data))
|
127
|
-
|
128
|
-
def copy(self) -> 'TaskDef':
|
129
|
-
ret = TaskDef(
|
130
|
-
name=self.name,
|
131
|
-
type=self.type,
|
132
|
-
depends=self.depends.copy())
|
133
|
-
return ret
|
134
146
|
|
135
147
|
TaskDef.model_rebuild()
|
136
148
|
|