Skip to content

Commit

Permalink
tests: add tests for optional artifact IO
Browse files Browse the repository at this point in the history
  • Loading branch information
mostaphaRoudsari authored and AntoineDao committed Jan 25, 2021
1 parent b47140a commit ba21e11
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/assets/functions/valid/function.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ inputs:
description: desired sky horizontal irradiance
required: true
- name: sky-file
type: FunctionFileInput
path: file.sky
required: true
command: gensky -c -B "{{ inputs.desired-irradiance }}" > file.sky
outputs:
Expand Down
36 changes: 36 additions & 0 deletions tests/assets/functions/valid/function_optional_input.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
type: Function
name: split-grid
description: Split the daylight sensor grid into multiple smaller files for parallel
simulation
inputs:
- name: grid-name
type: FunctionStringInput
default: grid
description: Name of the grid
- name: sensor-count
type: FunctionIntegerInput
default: 250
description: Number of sensors per split grid
- name: input-grid-folder
type: FunctionFolderInput
description: The folder containing the grids to split # this is important for copying the files.
path: asset/grid
required: true
- name: bsdf-folder
type: FunctionFolderInput
description: An optional input that should only be copied if available.
path: asset/xml
required: False

command: |
honeybee radiance grid split "asset/grid/{{inputs.grid-name}}.pts"
"{{inputs.sensor-count}}" --folder "output/temp/"
--log-file "output/temp/{{inputs.grid-name}}_grids.txt"
outputs:
- name: grid-list
type: FunctionArrayOutput
path: "output/temp/{{inputs.grid-name}}_grids.txt"
- name: output-grids-folder
type: FunctionFolderOutput
path: output/temp/
33 changes: 33 additions & 0 deletions tests/assets/functions/valid/function_optional_output.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
type: Function
name: split-grid
description: Split the daylight sensor grid into multiple smaller files for parallel
simulation
inputs:
- name: grid-name
type: FunctionStringInput
default: grid
description: Name of the grid
- name: sensor-count
type: FunctionIntegerInput
default: 250
description: Number of sensors per split grid
- name: input-grid-folder
type: FunctionFolderInput
description: The folder containing the grids to split # this is important for copying the files.
path: asset/grid
required: true
command: |
honeybee radiance grid split "asset/grid/{{inputs.grid-name}}.pts"
"{{inputs.sensor-count}}" --folder "output/temp/"
--log-file "output/temp/{{inputs.grid-name}}_grids.txt"
outputs:
- name: grid-list
type: FunctionArrayOutput
path: "output/temp/{{inputs.grid-name}}_grids.txt"
- name: output-grids-folder
type: FunctionFolderOutput
path: output/temp/
- name: optional-output
type: FunctionFolderOutput
path: output/temp/optional
required: False
46 changes: 46 additions & 0 deletions tests/assets/recipes/valid/optional-input-output.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
type: Recipe

metadata:
type: MetaData
name: minimal-recipe
tag: 0.2.1

dependencies:
- type: Dependency
kind: plugin
name: honeybee-radiance
tag: 1.2.3
source: https://example.com/test-repo

flow:
- name: main
type: DAG
inputs:
- name: folder-path
type: DAGStringInput
default: something
- name: input-file-optional
type: DAGFileInput
required: False
tasks:
- name: minimal-task
type: DAGTask
template: honeybee-radiance/10000-lux-sky
arguments:
- name: foo
type: TaskArgument
from:
type: ValueReference
value: test-value
- name: bar
type: TaskArgument
from:
type: ValueReference
value: test-value
outputs:
- name: optional-output
type: DAGFolderOutput
from:
type: FolderReference
path: path/to/file
required: False

0 comments on commit ba21e11

Please sign in to comment.