Load Dataset#

Configuration#

import os

from mlrun import mlconf

mlconf.dbpath = mlconf.dbpath or 'http://mlrun-api:8080'
mlconf.artifact_path = mlconf.artifact_path or f'{os.environ["HOME"]}/artifacts'

Run Locally#

from mlrun import run_local
from load_dataset import load_dataset

for dataset in ["wine", "iris", "breast_cancer"]:
    run_local(
        handler=load_dataset,
        inputs={"dataset": dataset},
        artifact_path=mlconf.artifact_path
    )

Run remotely#

from mlrun import import_function
from mlrun import NewTask

fn = import_function("hub://load_dataset")

if "V3IO_HOME" in os.environ:
    from mlrun import mount_v3io
    fn.apply(mount_v3io())
else:
    # is you set up mlrun using the instructions at https://github.com/mlrun/mlrun/blob/master/hack/local/README.md
    from mlrun.platforms import mount_pvc
    fn.apply(mount_pvc('nfsvol', 'nfsvol', '/home/joyan/data'))

task_params = {"name": "tasks load toy dataset", "params": {"dataset": "wine"}}

run = fn.run(NewTask(**task_params), artifact_path=mlconf.artifact_path)