Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
urigoren committed Mar 6, 2024
1 parent 16f63e5 commit 122a393
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 14 deletions.
8 changes: 4 additions & 4 deletions emb/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ async def embed_text(text: str) -> List[float]:
# " data": [app.title for app in apps]
# }

def my_periodic_task():
def embed_periodically():
print("Performing a periodic task every 5 minutes.")

@app.on_event("startup")
def start_scheduler():
scheduler.add_job(
my_periodic_task,
trigger=IntervalTrigger(minutes=5),
id="my_periodic_task", # ID for this job
embed_periodically,
trigger=IntervalTrigger(minutes=int(config("EMBED_FREQUENCY", default=5))),
id="embed_periodically",
replace_existing=True,
)
scheduler.start()
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion emb/db_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def generate_data_in_auctions(data_file_path):
# load extensions
load_pg_extensions()

data_file_path = 'test_data.csv'
data_file_path = 'auctions_data.csv'
logger.info(f"Going to load data from {data_file_path}")
generate_data_in_auctions(data_file_path)
logger.info("Done")
1 change: 0 additions & 1 deletion nb/db.py

This file was deleted.

13 changes: 5 additions & 8 deletions nb/sql.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
},
"outputs": [],
"source": [
"from sqlalchemy import create_engine\n",
"from sqlalchemy import create_engine, text\n",
"import pandas as pd\n",
"\n",
"db_con = create_engine('postgresql://postgres:argmax@pg:5432/postgres')\n"
"engine = create_engine('postgresql://postgres:argmax@pg:5432/postgres')\n"
]
},
{
Expand Down Expand Up @@ -82,14 +82,11 @@
}
],
"source": [
"\n",
"\n",
"# Define your SQL query\n",
"sql_query = 'SELECT * FROM auctions;'\n",
"with engine.connect() as db_con:\n",
" df = pd.read_sql(sql_query, con=db_con)\n",
"\n",
"df = pd.read_sql(sql_query, con=db_con)\n",
"\n",
"print(df)\n"
"df\n"
]
},
{
Expand Down

0 comments on commit 122a393

Please sign in to comment.