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

How to access data parameter value of ln.Artifact() constructor #2396

Closed
keller-mark opened this issue Jan 27, 2025 · 5 comments
Closed

How to access data parameter value of ln.Artifact() constructor #2396

keller-mark opened this issue Jan 27, 2025 · 5 comments

Comments

@keller-mark
Copy link
Contributor

Add a description

Hi,
Is there a way to access the value of the data parameter of the ln.Artifact constructor (Assuming the artifact was created using this constructor as opposed to from_df) if I only have a variable containing the resulting artifact instance?

I realize this is likely an anti-pattern which explains why there is not such a field listed in the public API docs at https://docs.lamin.ai/lamindb.artifact. However it would allow running VitessceConfig.widget() in a notebook such as https://github.com/laminlabs/lamin-spatial/blob/main/docs/vitessce.ipynb (for example, serving a local AnnData-Zarr directory on localhost to allow rendering the widget) prior to running save_vitessce_config or artifact.save(). If the data value is not available (for example, due to the artifact being fully remote or constructed via a different method such as from_df, or referencing a local directory that does not exist), Vitessce could throw an error that lets the user know this was the case.

@Koncopd
Copy link
Member

Koncopd commented Jan 27, 2025

Hi, i am not really sure what do you mean by accessing data parameter. What exactly should be in data?

@keller-mark
Copy link
Contributor Author

keller-mark commented Jan 27, 2025

h5ad_artifact = ln.Artifact(
    "./some_local_file.h5ad",
    key="some_key/some_local_file.h5ad",
    description="Some description",
    type="dataset",
)
h5ad_artifact.data == "./some_local_file.h5ad" # Would be True

Currently, as far as I understand, it is not possible to recover what the data value passed to the constructor was

@keller-mark
Copy link
Contributor Author

Maybe .path is what I am looking for, but is this available pre-.save() ? Would it still reference the local data after that data had been uploaded to S3?

@Koncopd
Copy link
Member

Koncopd commented Jan 27, 2025

Before saving it is ._local_filepath. But after saving it doesn't have any reference to the original object. However the original object is copied to the cache anyways and can be accessed via ._cache_path. The remote object can be accessed via .path.

@keller-mark
Copy link
Contributor Author

Great, that is what I was looking for, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants