Skip to content

Commit

Permalink
Fix s3 interface
Browse files Browse the repository at this point in the history
  • Loading branch information
akariv committed Jun 8, 2024
1 parent fd1bd28 commit 92dbeb0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions odds/common/store/s3/s3_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ async def storeDB(self, resource: Resource, dataset: Dataset, dbFile, ctx: str)
id = '{}/{}'.format(dataset.storeId(), resource.url)
key = self.get_key('db', id, 'sqlite')
rts.set(ctx, f'STORING RES-DB {resource.title} -> {key}')
await s3.upload_file(dbFile, bucket, key)
obj = await bucket.Object(key)
await obj.upload_file(dbFile)

async def storeEmbedding(self, dataset: Dataset, embedding: Embedding, ctx: str) -> None:
async with self.bucket() as (s3, bucket):
Expand All @@ -54,7 +55,8 @@ async def storeEmbedding(self, dataset: Dataset, embedding: Embedding, ctx: str)
filename = BytesIO()
np.save(filename, embedding)
filename.seek(0)
await s3.upload_fileobj(filename, bucket, key)
obj = await bucket.Object(key)
await obj.upload_fileobj(filename)

async def getDataset(self, datasetId: str) -> Dataset:
async with self.bucket() as (s3, bucket):
Expand Down
6 changes: 3 additions & 3 deletions utils/scrape_all.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
docker run -it \
-v ./odds.config.server.yaml:/srv/odds.config.yaml \
-v ./dummy-cache/:/srv/.caches/ \
odds-server -- "python utils/scrape_all.py"
-v ./odds.config.yaml:/srv/odds.config.yaml \
-v ./cache/:/srv/.caches/ \
ghcr.io/whiletrue-industries/odds/odds-server:latest -- "python utils/scrape_all.py"

0 comments on commit 92dbeb0

Please sign in to comment.