-
Notifications
You must be signed in to change notification settings - Fork 0
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 #4 from FAST-HEP/BK_add_future_instantiations
Add option for future instantiation of stages
- Loading branch information
Showing
8 changed files
with
129 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import logging | ||
logging.basicConfig() | ||
__version__ = "0.2.1" | ||
__version__ = "0.3.0" |
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 |
---|---|---|
@@ -1,13 +1,21 @@ | ||
from __future__ import absolute_import | ||
from .dict_config import read_sequence_dict | ||
from .dict_config import read_sequence_dict, compile_sequence_dict | ||
from .yaml_config import config_dict_from_yaml | ||
|
||
|
||
__all__ = ["read_sequence_yaml", "read_sequence_dict"] | ||
__all__ = ["read_sequence_yaml", "compile_sequence_yaml", | ||
"read_sequence_dict", "compile_sequence_dict"] | ||
|
||
|
||
def read_sequence_yaml(cfg_filename, output_dir=None, backend=None): | ||
cfg = config_dict_from_yaml(cfg_filename, | ||
output_dir=output_dir, | ||
backend=backend) | ||
return read_sequence_dict(**cfg) | ||
|
||
|
||
def compile_sequence_yaml(cfg_filename, output_dir=None, backend=None): | ||
cfg = config_dict_from_yaml(cfg_filename, | ||
output_dir=output_dir, | ||
backend=backend) | ||
return compile_sequence_dict(**cfg) |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[bumpversion] | ||
current_version = 0.2.1 | ||
current_version = 0.3.0 | ||
commit = True | ||
tag = False | ||
|
||
|
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 |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
|
||
setuptools.setup( | ||
name="fast-flow", | ||
version="0.2.1", | ||
version="0.3.0", | ||
author="Ben Krikler", | ||
author_email="[email protected]", | ||
description="YAML-based analysis flow description language", | ||
|
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,48 @@ | ||
from __future__ import absolute_import | ||
import pytest | ||
import fast_flow.v1 as fast_flow | ||
from . import fake_scribbler_to_test as fakes | ||
|
||
|
||
@pytest.fixture | ||
def config_1(tmpdir): | ||
content = """ | ||
general: | ||
backend: tests.fake_scribbler_to_test | ||
output_dir: %(tmpdir)s | ||
stages: | ||
- my_first_stage: tests.fake_scribbler_to_test.FakeScribbler | ||
- my_second_stage: FakeScribblerArgs | ||
my_first_stage: {} | ||
my_second_stage: | ||
an_int: 3 | ||
a_str: hello world | ||
some_other_arg: True | ||
yet_more_arg: [0, 1, 2] | ||
""" % dict(tmpdir=str(tmpdir)) | ||
out_file = tmpdir / "config.yml" | ||
out_file.write(content) | ||
return out_file | ||
|
||
|
||
def test_read_sequence_yaml(config_1): | ||
stages = fast_flow.read_sequence_yaml(str(config_1)) | ||
assert len(stages) == 2 | ||
assert isinstance(stages[0], fakes.FakeScribbler) | ||
assert isinstance(stages[1], fakes.FakeScribblerArgs) | ||
assert stages[1].an_int == 3 | ||
assert stages[1].a_str == "hello world" | ||
assert len(stages[1].other_args) == 2 | ||
|
||
|
||
def test_compile_sequence_yaml(config_1): | ||
stages = fast_flow.compile_sequence_yaml(str(config_1)) | ||
stages = stages() | ||
assert len(stages) == 2 | ||
assert isinstance(stages[0], fakes.FakeScribbler) | ||
assert isinstance(stages[1], fakes.FakeScribblerArgs) | ||
assert stages[1].an_int == 3 | ||
assert stages[1].a_str == "hello world" | ||
assert len(stages[1].other_args) == 2 |