-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #93 from scailfin/feature/yaml-include
Feature/yaml include
- Loading branch information
Showing
15 changed files
with
151 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ requests | |
SQLAlchemy>=1.3.18 | ||
papermill | ||
Click | ||
pyyaml-include | ||
boto3 | ||
google-cloud-storage | ||
docker | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Include me |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Include me, too |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# These are the main instructions. | ||
|
||
We also include: | ||
|
||
* {{include1.md}}, and | ||
* {{include2.md}}. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
name: names | ||
label: 'Input file' | ||
dtype: file | ||
target: data/names.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
name: sleeptime | ||
label: 'Sleep time (s)' | ||
dtype: int | ||
defaultValue: 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
workflow: | ||
version: 0.3.0 | ||
inputs: | ||
files: | ||
- $[[code]] | ||
- code/analyze.py | ||
- data/sequences.txt | ||
parameters: | ||
codefile: $[[code]] | ||
inputfile: data/sequences.txt | ||
outputfile: results/predictions.txt | ||
workflow: | ||
type: serial | ||
specification: | ||
steps: | ||
- environment: 'python:3.7' | ||
commands: | ||
- ${python} "${codefile}" | ||
--inputfile "${inputfile}" | ||
--outputfile "${outputfile}" | ||
- ${python} code/analyze.py | ||
--inputfile "${outputfile}" | ||
--outputfile results/eval.json | ||
outputs: | ||
files: | ||
- results/predictions.txt | ||
- results/eval.json | ||
parameters: | ||
- !include parameters/para1.yaml | ||
- !include parameters/para2.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# This file is part of the Reproducible and Reusable Data Analysis Workflow | ||
# Server (flowServ). | ||
# | ||
# Copyright (C) 2019-2021 NYU. | ||
# | ||
# flowServ is free software; you can redistribute it and/or modify it under the | ||
# terms of the MIT License; see LICENSE file for more details. | ||
|
||
"""Unit tests for reading a workflow templates that contains references to | ||
additional files using !include (pyyaml-include) and {{}} (in instructions | ||
markdown). | ||
""" | ||
|
||
import os | ||
|
||
from flowserv.model.workflow.manifest import read_instructions | ||
|
||
import flowserv.util as util | ||
|
||
|
||
DIR = os.path.dirname(os.path.realpath(__file__)) | ||
BENCHMARK_DIR = os.path.join(DIR, '../../.files/benchmark/include-test') | ||
INSTRUCTIONS_FILE = os.path.join(BENCHMARK_DIR, 'instructions.md') | ||
TEMPLATE_FILE = os.path.join(BENCHMARK_DIR, 'template.yaml') | ||
|
||
|
||
def test_read_instructions_with_include(): | ||
"""Test reading a template that includes other files.""" | ||
text = read_instructions(filename=INSTRUCTIONS_FILE) | ||
assert '# These are the main instructions.' in text | ||
assert '* Include me, and' in text | ||
assert '* Include me, too.' in text | ||
|
||
|
||
def test_read_template_with_include(): | ||
"""Test reading a template that includes other files.""" | ||
doc = util.read_object(filename=TEMPLATE_FILE) | ||
assert doc['parameters'] == [ | ||
{'name': 'names', 'label': 'Input file', 'dtype': 'file', 'target': 'data/names.txt'}, | ||
{'name': 'sleeptime', 'label': 'Sleep time (s)', 'dtype': 'int', 'defaultValue': 10} | ||
] |