fix strict-type validation by giving the example source a manifest
`dora validate` matches a node manifest to a `path:` node by entrypoint. With no manifest beside examples/source.py the root dora-node.yml was tried against it, did not match its entrypoint, and warned -- which `strict_types: true` turns into a non-zero exit, failing CI. Declaring the source's output types in the new manifest rather than as `output_types:` in dataflow.yml is also what makes them checked: an inline annotation shadows the manifest, so the manifest would be injected but never compared against the viewer's. Verified with dora-cli 1.0.1: validate passes with both contracts injected, and `CI=true SOURCE_FRAMES=30 dora run dataflow.yml --uv` runs both nodes to a clean exit.
This commit is contained in:
+2
-5
@@ -21,12 +21,9 @@ nodes:
|
|||||||
- image
|
- image
|
||||||
- bbox
|
- bbox
|
||||||
- text
|
- text
|
||||||
output_types:
|
|
||||||
image: std/core/v1/UInt8
|
|
||||||
text: std/core/v1/String
|
|
||||||
|
|
||||||
- id: plot
|
- id: view
|
||||||
path: dora-plot
|
path: dora-image-view
|
||||||
build: pip install .
|
build: pip install .
|
||||||
inputs:
|
inputs:
|
||||||
image: source/image
|
image: source/image
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
# Manifest for the example source node.
|
||||||
|
#
|
||||||
|
# Its reason to exist is as much mechanical as documentary: `dora validate`
|
||||||
|
# matches a node manifest to a `path:` node by entrypoint, and without a
|
||||||
|
# manifest here the repository-root dora-node.yml -- whose entrypoint is
|
||||||
|
# `dora-image-view` -- gets tried against `examples/source.py`, does not match,
|
||||||
|
# and warns. Under `strict_types: true` that warning fails the run.
|
||||||
|
#
|
||||||
|
# Declaring the types here rather than as `output_types:` in dataflow.yml is
|
||||||
|
# what makes them checked: an inline annotation shadows the manifest, so the
|
||||||
|
# manifest would be injected but never compared against dora-image-view's.
|
||||||
|
apiVersion: 1
|
||||||
|
name: source
|
||||||
|
namespace: liria
|
||||||
|
description: Synthetic image, bbox and text source for the dora-image-view example
|
||||||
|
categories: [debug]
|
||||||
|
keywords: [example, test, synthetic]
|
||||||
|
|
||||||
|
runtime: python
|
||||||
|
entrypoint: source.py
|
||||||
|
build: pip install .
|
||||||
|
dora: ">=1.0"
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
tick:
|
||||||
|
required: true
|
||||||
|
description: Timer tick; one frame is emitted per tick.
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
image:
|
||||||
|
type: std/core/v1/UInt8
|
||||||
|
description: >-
|
||||||
|
Animated bgr8 frame as a flat UInt8 buffer, with metadata
|
||||||
|
{width, height, encoding}.
|
||||||
|
bbox:
|
||||||
|
description: >-
|
||||||
|
The box around the moving square: an Arrow struct {bbox, conf, labels}
|
||||||
|
with metadata {format: xyxy}. Untyped to match the dora-image-view input.
|
||||||
|
text:
|
||||||
|
type: std/core/v1/String
|
||||||
|
description: A fixed caption.
|
||||||
|
|
||||||
|
env:
|
||||||
|
SOURCE_WIDTH:
|
||||||
|
type: int
|
||||||
|
description: Frame width in pixels. Defaults to 640.
|
||||||
|
SOURCE_HEIGHT:
|
||||||
|
type: int
|
||||||
|
description: Frame height in pixels. Defaults to 480.
|
||||||
|
SOURCE_FRAMES:
|
||||||
|
type: int
|
||||||
|
description: Stop after this many frames. 0, the default, runs until the viewer quits.
|
||||||
Reference in New Issue
Block a user