Skip to content

Commit

Permalink
updated s3 path for tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
khoroshevskyi committed May 28, 2024
1 parent a7d7211 commit 6d60e2b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 14 deletions.
1 change: 1 addition & 0 deletions bbconf/modules/bedfiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -929,6 +929,7 @@ def add_tokenized(self, bed_id: str, universe_id: str, token_vector: list) -> st
path = self._add_zarr_s3(
bed_id=bed_id, universe_id=universe_id, tokenized_vector=token_vector
)
path = os.path.join(f"s3://{self._config.config.s3.bucket}", path)

with Session(self._sa_engine) as session:
new_token = TokenizedBed(bed_id=bed_id, universe_id=universe_id, path=path)
Expand Down
43 changes: 29 additions & 14 deletions manual_testing.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import zarr
import s3fs
from dotenv import load_dotenv
import os


import s3fs
import zarr
from dotenv import load_dotenv
from geniml.io import RegionSet
from genimtools.tokenizers import TreeTokenizer
from genimtools.utils import read_tokens_from_gtok


from geniml.io import RegionSet

# from genimtools.tokenizers import RegionSet


Expand Down Expand Up @@ -105,16 +102,19 @@ def zarr_s3():

def get_from_s3():
s3fc_obj = s3fs.S3FileSystem(
endpoint_url="https://data3.bedbase.org/",
endpoint_url="https://data2.bedbase.org/",
# endpoint_url="https://s3.us-west-002.backblazeb2.com/",
# key=os.getenv("AWS_ACCESS_KEY_ID"),
# secret=os.getenv("AWS_SECRET_ACCESS_KEY"),
)
s3_path = "s3://bedbase/new/"

import s3fs
s3fc_obj = s3fs.S3FileSystem(endpoint_url="https://s3.us-west-002.backblazeb2.com/")
s3_path = "s3://bedbase/tokenized.zarr/"
zarr_store = s3fs.S3Map(root=s3_path, s3=s3fc_obj, check=False, create=True)
# cache = zarr.LRUStoreCache(zarr_store, max_size=2**28)
cache = zarr.LRUStoreCache(zarr_store, max_size=2**28)

# root = zarr.group(store=cache, overwrite=False)
root = zarr.group(store=cache, overwrite=False)
# print(str(root.tree))


Expand Down Expand Up @@ -148,11 +148,26 @@ def biocframe():
ff


def bio_cache():
pass
def dec1(func):
def wrapper(*args, **kwargs):
print("bbbb")
func(*args, **kwargs)

return wrapper

@dec1
def func1(a:str):
print("abc")
print(a)

func1("Donald")


if __name__ == "__main__":
# zarr_s3()
get_from_s3()
# get_from_s3()
# biocframe()




0 comments on commit 6d60e2b

Please sign in to comment.