dv-flow-mgr 0.0.2.14149088756a1__py3-none-any.whl → 0.0.2.14150065664a1__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 CHANGED
@@ -24,6 +24,7 @@ from .pkg_rgy import PkgRgy
24
24
  from .task_data import *
25
25
  from .task_def import *
26
26
  from .task_graph_builder import TaskGraphBuilder
27
+ from .task_run_ctxt import TaskRunCtxt
27
28
  from .task_runner import TaskRunner
28
29
  from .task_node_ctor_wrapper import task
29
30
  from .task_runner import TaskSetRunner
dv_flow/mgr/task_node.py CHANGED
@@ -111,7 +111,7 @@ class TaskNode(object):
111
111
  "rundir": rundir,
112
112
  "input": input.model_dump(warnings=False),
113
113
  "needs": [need[0].name for need in self.needs],
114
- "commands": [cmd.dump_model() for cmd in ctxt._exec_info],
114
+ "commands": [cmd.model_dump() for cmd in ctxt._exec_info],
115
115
  "result": {
116
116
  "status": self.result.status,
117
117
  "changed": self.result.changed,
@@ -116,10 +116,10 @@ class TaskNodeLeaf(TaskNode):
116
116
  inputs=inputs,
117
117
  memento=memento)
118
118
 
119
- ctxt = TaskRunCtxt(runner=self, rundir=input.rundir)
119
+ ctxt = TaskRunCtxt(runner=runner, rundir=input.rundir)
120
120
 
121
121
  self._log.debug("--> Call task method %s" % str(self.task))
122
- self.result : TaskDataResult = await self.task(self, input)
122
+ self.result : TaskDataResult = await self.task(ctxt, input)
123
123
  self._log.debug("<-- Call task method %s" % str(self.task))
124
124
 
125
125
  self.result.markers.extend(ctxt._markers)
@@ -23,6 +23,19 @@ class TaskRunCtxt(object):
23
23
  logfilter=None,
24
24
  cwd=None,
25
25
  env=None):
26
+ """
27
+ Executes a command as part of the task's implementation.
28
+ Output from the command will be saved to the specified logfile,
29
+ or to a default logfile if not specified. If the command
30
+ fails, an error marker will be added.
31
+
32
+ Example:
33
+
34
+ .. code-block:: python
35
+
36
+ status |= await runner.exec(['ls', '-l'], logfile='ls.log')
37
+
38
+ """
26
39
  if logfile is None:
27
40
  logfile = "cmd_%d.log" % (self._exec_info.__len__() + 1)
28
41
 
@@ -40,13 +53,29 @@ class TaskRunCtxt(object):
40
53
  self._exec_info.append(ExecInfo(cmd=cmd, status=status))
41
54
 
42
55
  if status != 0:
43
- self.error_marker("Command failed: %s" % " ".join(cmd))
56
+ self.error("Command failed: %s" % " ".join(cmd))
57
+
58
+ return status
59
+
60
+ def create(self, path, content):
61
+ """Create a file in the task's rundir"""
62
+ if not os.path.isabs(path):
63
+ path = os.path.join(self.rundir, path)
64
+
65
+ if not os.path.isdir(os.path.dirname(path)):
66
+ os.makedirs(os.path.dirname(path))
67
+
68
+ with open(path, "w") as fp:
69
+ fp.write(content)
70
+
44
71
 
45
72
  def marker(self, msg : str, severity : SeverityE, loc : TaskMarkerLoc=None):
73
+ """Add a marker related to the task's execution"""
46
74
  if loc is not None:
47
75
  self._markers.append(TaskMarker(msg=msg, severity=severity, loc=loc))
48
76
  else:
49
77
  self._markers.append(TaskMarker(msg=msg, severity=severity))
50
78
 
51
79
  def error(self, msg : str, loc : TaskMarkerLoc=None):
80
+ """Add an error marker related to the task's execution"""
52
81
  self.marker(msg=msg, severity=SeverityE.Error, loc=loc)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dv-flow-mgr
3
- Version: 0.0.2.14149088756a1
3
+ Version: 0.0.2.14150065664a1
4
4
  Summary: DV Flow Manager is a build system for silicon design
5
5
  Author-email: Matthew Ballance <matt.ballance@gmail.com>
6
6
  License: Apache License
@@ -1,4 +1,4 @@
1
- dv_flow/mgr/__init__.py,sha256=Zv-hbAhsxnQ49zy6_tKlwqgu5q12Yr7dCySyJMDtOO0,1154
1
+ dv_flow/mgr/__init__.py,sha256=hzwGMkN3t6RkfZSCHi_6mvEkCzEOd91EZBv9F2ZCa-8,1193
2
2
  dv_flow/mgr/__main__.py,sha256=ExLZCOjDZtxqPk_SSF5SZKkbYUjMmVca4sT2OeePv10,3437
3
3
  dv_flow/mgr/eval_jq.py,sha256=bRsHtaN51qIOiZK1VJV52W0-vj5VH0nQ7XIFebZi5kI,1129
4
4
  dv_flow/mgr/expr_eval.py,sha256=N_8hRIgzJK9JVqhRt8F9rc4S7AAdKHMMltafqk6KhJs,3113
@@ -19,7 +19,7 @@ dv_flow/mgr/task_def.py,sha256=Yf9bkWqSETeFUSbddbpvl2Cu3pyssvhdz0X2jxabniA,3751
19
19
  dv_flow/mgr/task_graph_builder.py,sha256=Z14ySv1SFanFovR8HePwKglyFSzc6JsS8Z4RLmggM6c,15316
20
20
  dv_flow/mgr/task_graph_dot_writer.py,sha256=GxqiYwQJbFgUQdnPCS9vpIYmYFbSXwnXCSbGmjbxC3M,2418
21
21
  dv_flow/mgr/task_listener_log.py,sha256=hrJEjSRXXoovDTcD1Cmhi3Spzw7uEJ-WP6tv6JUaa6s,4060
22
- dv_flow/mgr/task_node.py,sha256=4LlMRQ30ZdIk-nZ0FCTfyrusrQWF9LQ1g3vhgMJXMcc,4981
22
+ dv_flow/mgr/task_node.py,sha256=JXq2QimCZKxfhhkdhM-HKk4JbxpIlpW65xUJ0hVlQc0,4981
23
23
  dv_flow/mgr/task_node_compound.py,sha256=mNu4nf9hVqu2698ue5fpE3FeAOkvJH0Ke2W9V0G3-As,2975
24
24
  dv_flow/mgr/task_node_ctor.py,sha256=COFGvm5PR2B92H3uW1yhDIUCmppo9U4IfOcv_Jrsreo,3952
25
25
  dv_flow/mgr/task_node_ctor_compound.py,sha256=n2Ad1jtX147cb99HTlLrx_21XUn109bJ18zDXr0pn2Q,4259
@@ -28,10 +28,10 @@ dv_flow/mgr/task_node_ctor_def_base.py,sha256=_8QQHKDkONio_ve0Z409yxC0AMO8ocNBPD
28
28
  dv_flow/mgr/task_node_ctor_proxy.py,sha256=ViOFJ64JM4-CGFZNl89BghFuKSQ66kZVqSj4v2PA6VA,1906
29
29
  dv_flow/mgr/task_node_ctor_task.py,sha256=d49g90TyPCMFR8BuWWqp4ym-MW5vGSdDR0V47Ru28JY,2232
30
30
  dv_flow/mgr/task_node_ctor_wrapper.py,sha256=Nb1CVcPHZofnb-iLWDHQWAxlTOdbRrnR9DdSxY8yOec,3626
31
- dv_flow/mgr/task_node_leaf.py,sha256=f7LvifhUCRs94t_HpqJWyBygmjiN3KWgNjv-FaALj1s,7582
31
+ dv_flow/mgr/task_node_leaf.py,sha256=IXPYnjDJvfXEKWfmiyIMdS9DKcUU-PxGNPwyJBiOXyw,7584
32
32
  dv_flow/mgr/task_output.py,sha256=ZwyvwnYj_gHOEFAEOH3m24Xfc4Cn77hb1j7LkX8_3C4,1086
33
33
  dv_flow/mgr/task_params_ctor.py,sha256=BPkbnoCtzhCxc1g8CJ6VimCcm5UAu92PXeDMhQ4lYsQ,1957
34
- dv_flow/mgr/task_run_ctxt.py,sha256=ZyO0EzhWZ6uOAYhlByQQoYizyQWmJBSt8UhobTSb6n0,1728
34
+ dv_flow/mgr/task_run_ctxt.py,sha256=t2kGR-GbUC3s5YTYLxYmP43LRUvGKjqdGK5clRpAkzw,2624
35
35
  dv_flow/mgr/task_runner.py,sha256=-919VntXAe2XSuFW2dFpgvUre-NkILBnDBbAKBZYn5w,9594
36
36
  dv_flow/mgr/type.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
37
  dv_flow/mgr/type_def.py,sha256=NDeyplKrPnWwEv4yHkhXEMK9d9j39b5MOeLB-1Mchqo,1095
@@ -50,9 +50,9 @@ dv_flow/mgr/util/__main__.py,sha256=F0LXpCDpYTPalSo0dc1h_qZkip5v1AZYYh-vcYbh5s0,
50
50
  dv_flow/mgr/util/util.py,sha256=yg9oTPRiO87mkCSOQpOtlG9vyKPQzY3qp4OJkEMbWyY,1443
51
51
  dv_flow/mgr/util/cmds/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
52
52
  dv_flow/mgr/util/cmds/cmd_schema.py,sha256=lrEI-Jwb8j4I4yYOn9hq7_7NYbK8leVxLesrHyEWm-E,1879
53
- dv_flow_mgr-0.0.2.14149088756a1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
54
- dv_flow_mgr-0.0.2.14149088756a1.dist-info/METADATA,sha256=nHqGvVQydbFlAzyHjJhoWc51_cqtJzbUbjkWFVerQus,13336
55
- dv_flow_mgr-0.0.2.14149088756a1.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
56
- dv_flow_mgr-0.0.2.14149088756a1.dist-info/entry_points.txt,sha256=1roy8wAFM48LabOvr6jiOw0MUs-qE8X3Vf8YykPazxk,50
57
- dv_flow_mgr-0.0.2.14149088756a1.dist-info/top_level.txt,sha256=amfVTkggzYPtWwLqNmRukfz1Buu0pGS2SrYBBLhXm04,8
58
- dv_flow_mgr-0.0.2.14149088756a1.dist-info/RECORD,,
53
+ dv_flow_mgr-0.0.2.14150065664a1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
54
+ dv_flow_mgr-0.0.2.14150065664a1.dist-info/METADATA,sha256=9jJBGIp_ylYV8SgeRvZh0P1EcYH4cQHSLaHEF2Mr_QA,13336
55
+ dv_flow_mgr-0.0.2.14150065664a1.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
56
+ dv_flow_mgr-0.0.2.14150065664a1.dist-info/entry_points.txt,sha256=1roy8wAFM48LabOvr6jiOw0MUs-qE8X3Vf8YykPazxk,50
57
+ dv_flow_mgr-0.0.2.14150065664a1.dist-info/top_level.txt,sha256=amfVTkggzYPtWwLqNmRukfz1Buu0pGS2SrYBBLhXm04,8
58
+ dv_flow_mgr-0.0.2.14150065664a1.dist-info/RECORD,,