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

Fixing quick start #477

Merged
merged 8 commits into from
Oct 15, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions dockerfiles/jupyter/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ ENV MLRUN_DBPATH=http://localhost:8080 \
JUPYTER_ENABLE_LAB=yes \
MLRUN_HTTPDB__DATA_VOLUME=$HOME/data \
MLRUN_HTTPDB__DSN='sqlite:////home/jovyan/data/mlrun.db?check_same_thread=false' \
MLRUN_HTTPDB__LOGS_PATH=$HOME/data/logs \
MLRUN_PVC_MOUNT=nfsvol:/home/jovyan/data

# run the mlrun db (api) and the notebook in parallel
Expand Down
9 changes: 4 additions & 5 deletions docs/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,14 @@ MLRun requires separate containers for the API and the dashboard (UI).

To install and run MLRun locally using Docker:
``` sh
MLRUN_IP=localhost
SHARED_DIR=/home/me/data
# On Windows, use host.docker.internal for MLRUN_IP
SHARED_DIR=~/mlrun-data

docker pull mlrun/mlrun-ui:0.5.2
docker pull mlrun/jupyter:0.5.2

docker run -it -p 4000:80 --rm -d --name mlrun-ui -e MLRUN_API_PROXY_URL=http://${MLRUN_IP}:8080 mlrun/mlrun-ui:0.5.2
docker run -it -p 8080:8080 -p 8888:8888 --rm -d --name jupy -v $(SHARED_DIR}:/home/jovyan/data mlrun/jupyter:0.5.2
docker network create mlrun-network
docker run -it -p 8080:8080 -p 8888:8888 --rm -d --network mlrun-network --name jupyter -v ${SHARED_DIR}:/home/jovyan/data mlrun/jupyter:0.5.2
docker run -it -p 4000:80 --rm -d --network mlrun-network --name mlrun-ui -e MLRUN_API_PROXY_URL=http://jupyter:8080 mlrun/mlrun-ui:0.5.2
```

When using Docker MLRun can only use local runs.
Expand Down
27 changes: 15 additions & 12 deletions mlrun/api/api/endpoints/workflows.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from fastapi import APIRouter

from mlrun.run import list_piplines
from mlrun.k8s_utils import get_k8s_helper
from mlrun.run import list_pipelines

router = APIRouter()

Expand All @@ -15,16 +16,18 @@ def list_workflows(
full: bool = False,
page_size: int = 10,
):
total_size, next_page_token, runs = list_piplines(
full=full,
page_token=page_token,
page_size=page_size,
sort_by=sort_by,
experiment_id=experiment_id,
namespace=namespace,
)
total_size, next_page_token, runs = None, None, None
if get_k8s_helper(silent=True).is_running_inside_kubernetes_cluster():
total_size, next_page_token, runs = list_pipelines(
full=full,
page_token=page_token,
page_size=page_size,
sort_by=sort_by,
experiment_id=experiment_id,
namespace=namespace,
)
return {
"runs": runs,
"total_size": total_size,
"next_page_token": next_page_token,
"runs": runs or [],
"total_size": total_size or 0,
"next_page_token": next_page_token or None,
}
2 changes: 1 addition & 1 deletion mlrun/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,7 @@ def get_pipeline(run_id, namespace=None):
return resp


def list_piplines(
def list_pipelines(
full=False,
page_token="",
page_size=10,
Expand Down
18 changes: 18 additions & 0 deletions tests/api/api/test_workflows.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import deepdiff
from http import HTTPStatus

from fastapi.testclient import TestClient
from sqlalchemy.orm import Session


def test_list_workflows(db: Session, client: TestClient) -> None:
response = client.get("/api/workflows")
assert response.status_code == HTTPStatus.OK.value
expected_response = {
"runs": [],
"total_size": 0,
"next_page_token": None,
}
assert (
deepdiff.DeepDiff(expected_response, response.json(), ignore_order=True,) == {}
)