Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Wrapper around BigQuery call.""" | |
from __future__ import annotations | |
from typing import Any, Iterable | |
import logging | |
from google.cloud import bigquery_storage | |
from google.cloud.bigquery_storage_v1 import exceptions as bqstorage_exceptions | |
from google.cloud.bigquery_storage_v1 import types, writer | |
from google.protobuf import descriptor_pb2 | |
from google.protobuf.descriptor import Descriptor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from google.cloud.bigquery_storage import BigQueryReadClient | |
from google.cloud.bigquery_storage import types | |
from google.cloud import bigquery_storage | |
from tqdm import tqdm | |
import pandas | |
import os | |
import dill | |
project_id = ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import io | |
import json | |
import math | |
import time | |
import random | |
import numpy as np | |
import cachetools.func | |
import sqlite3 | |
from loguru import logger |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
✓ Initialized. View app at https://modal.com/apps/ap-lHATR9JHJ7S5eGXYHigc75 | |
✓ Created objects. | |
├── 🔨 Created sample_fn. | |
├── 🔨 Mounted /Users/chris/code/search/gumbase/jobs/partition.py at /root | |
├── 🔨 Mounted /Users/chris/code/gumhouse/gumhouse at /root/gumhouse | |
├── 🔨 Created sample_job. | |
├── 🔨 Created fit_top_level_kmeans. | |
├── 🔨 Created scatter_by_centroids_single. | |
├── 🔨 Created scatter_by_centroids. | |
├── 🔨 Created gather_single. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: vespa | |
labels: | |
app: vespa | |
spec: | |
selector: | |
app: vespa | |
type: NodePort |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import multiprocessing | |
import queue | |
from loguru import logger | |
import pandas as pd | |
def chunks(df, chunk_size=1000): | |
for i in range(0, len(df), chunk_size): | |
yield df[i : i + chunk_size] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import pickle | |
import time | |
import glob | |
import joblib | |
import inspect | |
from loguru import logger | |
def persist_to_file(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def switch_modal_function(stub=None, use_modal=True, **kwargs): | |
def wrapper(inner_func): | |
if use_modal: | |
assert stub is not None, "If using modal, please provide `stub`." | |
return stub.function(**kwargs)(inner_func) | |
else: | |
return inner_func | |
return wrapper |
NewerOlder