pythonamazon-s3mlrun

How to read csv file stored as an artifact in MLrun


I am new to MLRun . Facing below issue In MLrun , I have saved my artifact (csv file) using the mlrun context .

context.log_artifact(TableArtifact('mydf', df=dataset, visible=True))

Now I wanted to read the csv file some other function .How can I read that artifact . When I saved the artifact it is getting stored into the s3 Bucket. for example :

s3://mlrun/projects/test-pipeline/artifacts/data-prep-test-data-generator/0/mydf.csv

is it possible to read from that path. When i am trying to access it directly using pd.read_csv("s3://mlrun/projects/test-pipeline/artifacts/data-prep-test-data-generator/0/mydf.csv")

it is telling this bucket doesn't exist. Is there any MLrun api to read this file . I could not find any .


Solution

  • I have found the below solution .

    mlrun.get_dataitem('s3://mlrun/projects/{project_name}-jovyan/artifacts/trainer-train/0/mydf.csv').as_df()
    

    Project_name is MLRun project name