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

Scarf core package #120

Open
oskbor opened this issue Aug 14, 2024 · 0 comments
Open

Scarf core package #120

oskbor opened this issue Aug 14, 2024 · 0 comments

Comments

@oskbor
Copy link
Contributor

oskbor commented Aug 14, 2024

Usually scarf methods looks a bit like this

my_func(cell_key: str, feat_key:str):
	# load stuff from datastore
	# do stuff
	# save results to datastore

it would be awesome if we could extract all the "do stuff" to a core library inside scarf. So the new code in scarf would look something like

import do_stuff from "scarf.core"

my_func(cell_key: str, feat_key:str):
	# load stuff from datastore
	results = do_stuff(loaded_stuff)
	# save results to datastore

Basically all the functions in core should aim to be pure, they return their results rather than writing them to disk.
For complex things, we could return a stream or iterable that can be consumed or written to disk as needed.

Installing the scarf core package should not include all the graphing, progress bars etc.

Other loose thoughts

  • Have a few data types. Vector, matrix, HNSW index?, graph?, featureSet, cellSet. all of these should be hashable.
  • Nothing shall ever be overwritten. If its the same inputs, return the old output. Store every run to disk
  • Every task does something like this:
    1. All inputs must be hashable. All tasks have an id. On call, hash the input and check if store.has("<id>:<hash>"). If so return the cached content.
    2. If there is nothing in the store, compute the object, store it in the store and return it (or return its hash).
type DataType = "cellSubset" | "featureSubset" | "vector" | "matrix" | "etc" | "sparseMatrix"
type Store = {
  get(key: string) : DataType | null,
  has(key: string): boolean,
  save(key: string, val: DataType),
}
@oskbor oskbor closed this as completed Aug 14, 2024
@oskbor oskbor reopened this Aug 14, 2024
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

1 participant