Skip to content

Commit 1e6d28c

Browse files
refactor: switch back to composite wording
Signed-off-by: Matthias Pichler <[email protected]>
1 parent 06fa87a commit 1e6d28c

File tree

4 files changed

+82
-87
lines changed

4 files changed

+82
-87
lines changed

ctk/features/branch.feature

Lines changed: 0 additions & 31 deletions
This file was deleted.

ctk/features/composite.feature

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
Feature: Composite Task
2+
As an implementer of the workflow DSL
3+
I want to ensure that composite tasks can be executed within the workflow
4+
So that my implementation conforms to the expected behavior
5+
6+
# Tests composite tasks with sequential sub tasks
7+
Scenario: Composite Task With Sequential Sub Tasks
8+
Given a workflow with definition:
9+
"""yaml
10+
document:
11+
dsl: 1.0.0-alpha1
12+
namespace: default
13+
name: composite-sequential
14+
do:
15+
- compositeExample:
16+
do:
17+
- setRed:
18+
set:
19+
colors: ${ .colors + ["red"] }
20+
- setGreen:
21+
set:
22+
colors: ${ .colors + ["green"] }
23+
- setBlue:
24+
set:
25+
colors: ${ .colors + ["blue"] }
26+
"""
27+
When the workflow is executed
28+
Then the workflow should complete with output:
29+
"""yaml
30+
colors: [ red, green, blue ]
31+
"""
32+
33+
# Tests composite tasks With competing concurrent sub tasks
34+
Scenario: Composite Task With Competing Concurrent Sub Tasks
35+
Given a workflow with definition:
36+
"""yaml
37+
document:
38+
dsl: 1.0.0-alpha1
39+
namespace: default
40+
name: composite-sequential
41+
do:
42+
- branchWithCompete:
43+
branch:
44+
compete: true
45+
on:
46+
- setRed:
47+
set:
48+
colors: ${ .colors + ["red"] }
49+
- setGreen:
50+
set:
51+
colors: ${ .colors + ["green"] }
52+
- setBlue:
53+
set:
54+
colors: ${ .colors + ["blue"] }
55+
"""
56+
When the workflow is executed
57+
Then the workflow should complete
58+
And the workflow output should have a 'colors' property containing 1 items

ctk/features/do.feature

Lines changed: 0 additions & 30 deletions
This file was deleted.

schema/workflow.yaml

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,7 @@ $defs:
128128
unevaluatedProperties: false
129129
oneOf:
130130
- $ref: '#/$defs/callTask'
131-
- $ref: '#/$defs/doTask'
132-
- $ref: '#/$defs/branchTask'
131+
- $ref: '#/$defs/compositeTask'
133132
- $ref: '#/$defs/emitTask'
134133
- $ref: '#/$defs/forTask'
135134
- $ref: '#/$defs/listenTask'
@@ -286,32 +285,31 @@ $defs:
286285
additionalProperties: true
287286
description: A name/value mapping of the parameters, if any, to call the function with.
288287
required: [ call ]
289-
branchTask:
290-
description: Allows to execute multiple tasks concurrently.
291-
$ref: '#/$defs/taskBase'
292-
type: object
293-
required: [ branch ]
294-
unevaluatedProperties: false
295-
properties:
296-
branch:
288+
compositeTask:
289+
description: Serves as a pivotal orchestrator within workflow systems, enabling the seamless integration and execution of multiple subtasks to accomplish complex operations
290+
oneOf:
291+
- $ref: '#/$defs/taskBase'
297292
type: object
298-
required: [ "on" ]
293+
unevaluatedProperties: false
294+
required: [ branch ]
299295
properties:
300-
on:
301-
$ref: '#/$defs/taskList'
302-
compete:
303-
description: Indicates whether or not the concurrent tasks are racing against each other, with a single possible winner, which sets the composite task's output.
304-
type: boolean
305-
default: false
306-
doTask:
307-
$ref: '#/$defs/taskBase'
308-
type: object
309-
required: [ do ]
310-
unevaluatedProperties: false
311-
description: Allows to execute multiple tasks sequentially.
312-
properties:
313-
do:
314-
$ref: '#/$defs/taskList'
296+
branch:
297+
type: object
298+
required: [ 'on' ]
299+
properties:
300+
on:
301+
$ref: '#/$defs/taskList'
302+
compete:
303+
description: Indicates whether or not the concurrent tasks are racing against each other, with a single possible winner, which sets the composite task's output.
304+
type: boolean
305+
default: false
306+
- $ref: '#/$defs/taskBase'
307+
type: object
308+
unevaluatedProperties: false
309+
required: [ do ]
310+
properties:
311+
do:
312+
$ref: '#/$defs/taskList'
315313
emitTask:
316314
description: Allows workflows to publish events to event brokers or messaging systems, facilitating communication and coordination between different components and services.
317315
$ref: '#/$defs/taskBase'

0 commit comments

Comments
 (0)