Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

have minimal tests up-to-date and working #20

Merged
merged 4 commits into from
Jan 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pipeline/objects/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def execute_func(*args, **kwargs):
)

node_output = Variable(type_class=function.__annotations__["return"])
# Pipeline.add_variable(node_output)
Pipeline.add_variable(node_output)
Pipeline.add_function(function.__pipeline_function__)
new_node = GraphNode(
function=function.__pipeline_function__,
Expand Down
4 changes: 2 additions & 2 deletions pipeline/objects/graph_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
class GraphNode:
local_id: str
function: Function
inputs = [] #: List[Variable]
outputs = [] #: List[Variable]
inputs: List[Variable] = []
outputs: List[Variable] = []

def __init__(self, function, inputs, outputs, *, local_id=None):
self.function = function
Expand Down
5 changes: 5 additions & 0 deletions pipeline/objects/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ def add_variable(variable: Variable) -> None:
else:
raise Exception("Cant add a variable when not defining a pipeline!")

@staticmethod
def add_variables(*variables: Variable) -> None:
for v in variables:
Pipeline.add_variable(v)

@staticmethod
def add_function(function: Function) -> None:
if Pipeline._pipeline_context_active:
Expand Down
6 changes: 0 additions & 6 deletions pipeline/objects/variable.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
from typing import Any

# from pipeline.objects.pipeline import Pipeline
from pipeline.schemas.pipeline import PipelineVariableGet
from pipeline.util import generate_id, hex_to_python_object

# from pipeline.objects import Pipeline


class Variable:

Expand Down Expand Up @@ -37,9 +34,6 @@ def __init__(

self.local_id = generate_id(10) if not local_id else local_id

# if Pipeline._pipeline_context_active:
# Pipeline.add_variable(self)

@classmethod
def from_schema(cls, schema: PipelineVariableGet):
return cls(
Expand Down
24 changes: 22 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pipeline-ai"
version = "0.0.12"
version = "0.0.20"
description = "Yay ml pipelines"
authors = ["Paul Hetherington <paul@getneuro.ai>"]
packages = [
Expand All @@ -23,6 +23,7 @@ setuptools = "^59.2.0"
humps = "^0.2.2"
pyhumps = "^3.0.2"
requests-toolbelt = "^0.9.1"
tqdm = "^4.62.3"

[tool.poetry.dev-dependencies]
setuptools = "^59.2.0"
Expand Down
58 changes: 0 additions & 58 deletions tests/test_function_schemas.py

This file was deleted.

2 changes: 2 additions & 0 deletions tests/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ def load(self, path: str) -> None:

with Pipeline("test") as my_pipeline:
in_1 = Variable(str, is_input=True)
my_pipeline.add_variable(in_1)

my_model = CustomModel()
str_1 = my_model.predict(in_1)

Expand Down
8 changes: 4 additions & 4 deletions tests/test_pipeline_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def test_with_decorator_name():
# Test exit
def test_with_exit():
with Pipeline("test"):
Variable(is_input=True, is_output=True)
Variable(str, is_input=True, is_output=True)
assert Pipeline.get_pipeline("test").name == "test"


Expand All @@ -34,13 +34,13 @@ def square(f_1: float) -> float:
in_1 = Variable(float, is_input=True)
in_2 = Variable(float, is_input=True)

my_pipeline.add_variables(in_1, in_2)

add_1 = add(in_1, in_2)
sq_1 = square(add_1)

my_pipeline.output(sq_1, add_1)

graph = Pipeline.get_pipeline("test")

output = graph.run(2.0, 3.0)
output = Pipeline.run_local("test", 2.0, 3.0)
assert output == [25.0, 5.0]
assert Pipeline._current_pipeline is None
108 changes: 0 additions & 108 deletions tests/test_pipeline_schemas.py

This file was deleted.