Skip to content

Commit

Permalink
[Projects] Add goals field (#608)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hedingber committed Dec 20, 2020
1 parent de956e3 commit e5d3eb4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions mlrun/api/schemas/project.py
Expand Up @@ -20,6 +20,7 @@ class Config:

class ProjectSpec(pydantic.BaseModel):
description: typing.Optional[str] = None
goals: typing.Optional[str] = None
params: typing.Optional[dict] = None
functions: typing.Optional[list] = None
workflows: typing.Optional[list] = None
Expand Down
2 changes: 2 additions & 0 deletions mlrun/projects/project.py
Expand Up @@ -223,6 +223,7 @@ def __init__(
source=None,
subpath=None,
origin_url=None,
goals=None,
):
self.repo = None

Expand All @@ -233,6 +234,7 @@ def __init__(
self.source = source or ""
self.subpath = subpath or ""
self.origin_url = origin_url or ""
self.goals = goals
self.branch = None
self.tag = ""
self.params = params or {}
Expand Down
6 changes: 4 additions & 2 deletions tests/api/api/test_projects.py
Expand Up @@ -12,7 +12,9 @@ def test_projects_crud(db: Session, client: TestClient) -> None:
name1 = f"prj-{uuid4().hex}"
project_1 = mlrun.api.schemas.Project(
metadata=mlrun.api.schemas.ProjectMetadata(name=name1),
spec=mlrun.api.schemas.ProjectSpec(description="banana", source="source"),
spec=mlrun.api.schemas.ProjectSpec(
description="banana", source="source", goals="some goals"
),
)

# create
Expand All @@ -39,7 +41,7 @@ def test_projects_crud(db: Session, client: TestClient) -> None:
labels_2 = {"key": "value"}
project_2 = mlrun.api.schemas.Project(
metadata=mlrun.api.schemas.ProjectMetadata(name=name2, labels=labels_2),
spec=mlrun.api.schemas.ProjectSpec(description="banana", source="source"),
spec=mlrun.api.schemas.ProjectSpec(description="banana2", source="source2"),
)

# store
Expand Down
2 changes: 2 additions & 0 deletions tests/rundb/test_httpdb.py
Expand Up @@ -528,6 +528,7 @@ def test_project_file_db_roundtrip(create_server):

project_name = "project-name"
description = "project description"
goals = "project goals"
params = {"param_key": "param value"}
artifact_path = "/tmp"
conda = "conda"
Expand All @@ -546,6 +547,7 @@ def test_project_file_db_roundtrip(create_server):
source=source,
subpath=subpath,
origin_url=origin_url,
goals=goals,
)
project = mlrun.projects.project.MlrunProject(
metadata=project_metadata, spec=project_spec
Expand Down

0 comments on commit e5d3eb4

Please sign in to comment.