コード例 #1
0
ファイル: test_exe.py プロジェクト: yaxonomic/yax
    def test_single(self):
        graph = ExeGraph()
        n1 = ExeNode('foo', in0out1, output='a')

        graph.add(n1)

        self.assertEqual(collections.OrderedDict([(n1, [])]),
                         graph.adjacency_matrix)
コード例 #2
0
class Indiana:
    def __init__(self):
        self.graph = ExeGraph()
        for name, main in pipeline:
            node = ExeNode(name, main)
            self.graph.append(node)

    def __repr__(self):
        return '\n'.join([repr(node) for node in self.graph])
コード例 #3
0
ファイル: jones.py プロジェクト: yaxonomic/yax
    def __init__(self, root_dir, pipeline=None, init=False):
        """Initialize Indiana, will create .yax dir if not exists.

        Parameters
        ----------
        root_dir : path to directory
            The current (or eventual) location which contains a yax pipeline.
        pipeline : filepath
            A path to an architectural configuration file. This can only be
            provided if `root_dir` is not already a yax pipeline.

        Raises
        ------
        ValueError
            Raised when `pipeline` provided to an initialized yax pipeline.

        """
        self.root_dir = root_dir
        if not os.path.isdir(self.data_dir):
            if not init:
                raise ValueError("Current directory is not a yax pipeline,"
                                 " see `yax init`.")
            self._init_first_time(pipeline)
        elif pipeline is not None:
            raise ValueError("'pipeline' was provided to an already"
                             " initialized yax pipeline.")

        self.graph = ExeGraph.from_config(self.arch_path)
        self.map = ArtifactMap(self.artifacts_dir, self.artifact_db_path,
                               self.graph)
コード例 #4
0
ファイル: jones.py プロジェクト: MikeDeberg/yax
    def __init__(self, root_dir, pipeline=None):
        """Initialize Indiana, will create .yax dir if not exists.

        Parameters
        ----------
        root_dir : path to directory
            The current (or eventual) location which contains a yax pipeline.
        pipeline : filepath
            A path to an architectural configuration file. This can only be
            provided if `root_dir` is not already a yax pipeline.

        Raises
        ------
        ValueError
            Raised when `pipeline` provided to an initialized yax pipeline.

        """
        self.root_dir = root_dir
        if not os.path.isdir(self.data_dir):
            self._init_first_time(pipeline)
        elif pipeline is not None:
            raise ValueError("'pipeline' was provided to an already"
                             " initialized yax pipeline.")

        self.graph = ExeGraph.from_config(self.arch_path)
        self.map = ArtifactMap(self.artifacts_dir, self.artifact_db_path,
                               self.graph)
コード例 #5
0
ファイル: jones.py プロジェクト: DaLumberjack/yax
    def __init__(self, dir_, pipeline=None):
        self.root_dir = dir_
        if not os.path.isdir(self.data_dir):
            self._init_first_time(pipeline)
        elif pipeline is not None:
            raise ValueError("'pipeline' was provided to an already"
                             " initialized yax pipeline.")

        self.graph = ExeGraph.from_config(self.arch_path)
        self.map = ArtifactMap(self.artifact_db_path, self.graph)
コード例 #6
0
    def __init__(self, dir_, pipeline=None):
        self.root_dir = dir_
        if not os.path.isdir(self.data_dir):
            self._init_first_time(pipeline)
        elif pipeline is not None:
            raise ValueError("'pipeline' was provided to an already"
                             " initialized yax pipeline.")

        self.graph = ExeGraph.from_config(self.arch_path)
        self.map = ArtifactMap(self.artifacts_dir, self.artifact_db_path,
                               self.graph)
コード例 #7
0
ファイル: test_exe.py プロジェクト: yaxonomic/yax
    def test_simple_chain(self):
        graph = ExeGraph()
        n1 = ExeNode('foo', in0out1, output='a')
        n2 = ExeNode('foh', in1out1, input={'a': 'x'}, output='b')
        n3 = ExeNode('fum', in1out1, input={'b': 'x'}, output='c')

        expected = collections.OrderedDict([
            (n1, [n2]),
            (n2, [n3]),
            (n3, [])
        ])

        graph.add(n1)
        graph.add(n2)
        graph.add(n3)

        self.assertEqual(expected, graph.adjacency_matrix)
コード例 #8
0
ファイル: test_exe.py プロジェクト: yaxonomic/yax
    def test_diamond(self):
        graph = ExeGraph()
        n1 = ExeNode('fee', in0out2, output=('a', 'b'))
        n2 = ExeNode('fie', in1out1, input={'a': 'x'}, output='c')
        n3 = ExeNode('foh', in1out1, input={'b': 'x'}, output='d')
        n4 = ExeNode('fum', in2out1, input={'c': 'x', 'd': 'y'}, output='e')

        expected = collections.OrderedDict([
            (n1, [n2, n3]),
            (n2, [n4]),
            (n3, [n4]),
            (n4, [])
        ])

        graph.add(n1)
        graph.add(n2)
        graph.add(n3)
        graph.add(n4)
        self.assertEqual(expected, graph.adjacency_matrix)
コード例 #9
0
ファイル: arch_config.py プロジェクト: yaxonomic/yax
from yax.state.exe import ExeGraph, ExeNode

from yax.modules.example.module import main as example_main

pipeline = ExeGraph()

pipeline.add(ExeNode('example', example_main, output=('a', 'b')))
コード例 #10
0
ファイル: arch_config.py プロジェクト: DaLumberjack/yax
from yax.state.exe import ExeGraph, ExeNode

from yax.modules.example.module import main as example_main

pipeline = ExeGraph()

pipeline.add(ExeNode('example', example_main,
             output=('a', 'b')))
コード例 #11
0
ファイル: arch_config.py プロジェクト: DaLumberjack/yax
from yax.state.exe import ExeGraph, ExeNode

from yax.state.tests.test_pipeline.modules.module_1 import main as main_1
from yax.state.tests.test_pipeline.modules.module_2 import main as main_2
from yax.state.tests.test_pipeline.modules.module_3 import main as main_3
from yax.state.tests.test_pipeline.modules.module_4 import main as main_4

pipeline = ExeGraph()

pipeline.add(ExeNode('module1', main_1,
                     output=('a', 'b')))

pipeline.add(ExeNode('module2', main_2,
                     output=('c', 'x')))

pipeline.add(ExeNode('module3', main_3,
                     input={'b': 'art_b',
                            'c': 'art_c'},
                     output='d'))

pipeline.add(ExeNode('module4', main_4,
                     input={'a': 'art_a',
                            'd': 'art_d'},
                     output='y'))
コード例 #12
0
from yax.state.exe import ExeGraph, ExeNode
from yax.state.type import Str, Int, Float

from yax.state.tests.test_pipeline.modules.module_1 import main as main_1
from yax.state.tests.test_pipeline.modules.module_2 import main as main_2
from yax.state.tests.test_pipeline.modules.module_3 import main as main_3
from yax.state.tests.test_pipeline.modules.module_4 import main as main_4

pipeline = ExeGraph()

pipeline.set_details({
    'some_detail': (Str, "foo"),
    'other_detail': Int,
    'too_much_detail': (Float, float('inf'))
})

pipeline.add(ExeNode('module1', main_1,
                     output=('a', 'b')))

pipeline.add(ExeNode('module2', main_2,
                     output=('c', 'x')))

pipeline.add(ExeNode('module3', main_3,
                     input={'b': 'art_b',
                            'c': 'art_c'},
                     output='d'))

pipeline.add(ExeNode('module4', main_4,
                     input={'a': 'art_a',
                            'd': 'art_d'},
                     output='y'))
コード例 #13
0
ファイル: test_exe.py プロジェクト: yaxonomic/yax
 def test_empty(self):
     graph = ExeGraph()
     self.assertEqual(collections.OrderedDict(), graph.adjacency_matrix)
コード例 #14
0
 def __init__(self):
     self.graph = ExeGraph()
     for name, main in pipeline:
         node = ExeNode(name, main)
         self.graph.append(node)