Skip to content

Commit

Permalink
NOTE: Add git_hash column to the slick_to_source table
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaraphael committed Nov 25, 2024
1 parent 83f6118 commit f74dba6
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions alembic/versions/3c4693517ef6_add_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ def upgrade() -> None:
sa.Column("slick", sa.BigInteger, sa.ForeignKey("slick.id"), nullable=False),
sa.Column("source", sa.BigInteger, sa.ForeignKey("source.id"), nullable=False),
sa.Column("active", sa.Boolean, nullable=False),
sa.Column("git_hash", sa.Text),
sa.Column("coincidence_score", sa.Float),
sa.Column("collated_score", sa.Float),
sa.Column("rank", sa.BigInteger),
Expand Down
6 changes: 6 additions & 0 deletions alembic/versions/7cd715196b8d_add_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ def upgrade() -> None:

op.create_index("idx_source_name", "source", ["st_name", "type"])

op.create_index(
"idx_slick_to_source_collated_score", "slick_to_source", ["collated_score"]
)

op.create_index("idx_slick_to_aoi_slick", "slick_to_aoi", ["slick"])
op.create_index("idx_slick_to_aoi_aoi", "slick_to_aoi", ["aoi"])

Expand Down Expand Up @@ -76,6 +80,8 @@ def downgrade() -> None:

op.drop_index("idx_source_name", "source")

op.drop_index("idx_slick_to_source_collated_score", "slick_to_source")

op.drop_index("idx_filter_hash", "filter")

op.drop_index("idx_slick_hitl", "slick")
Expand Down
1 change: 1 addition & 0 deletions cerulean_cloud/cloud_function_ais_analysis/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ async def handle_asa_request(request):
source=source.id,
slick=slick.id,
active=True,
git_hash=os.getenv("GIT_HASH"),
coincidence_score=source_row["coincidence_score"],
collated_score=source_row["collated_score"],
rank=idx + 1,
Expand Down
1 change: 1 addition & 0 deletions cerulean_cloud/database_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@ class SlickToSource(Base): # noqa
slick = Column(ForeignKey("slick.id"), nullable=False)
source = Column(ForeignKey("source.id"), nullable=False)
active = Column(Boolean, nullable=False)
git_hash = Column(Text)
coincidence_score = Column(Float(53))
collated_score = Column(Float(53))
rank = Column(BigInteger)
Expand Down
4 changes: 4 additions & 0 deletions stack/cloud_function_ais_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import time

import database
import git
import pulumi
from pulumi_gcp import cloudfunctions, cloudtasks, projects, serviceaccount, storage
from utils import construct_name, pulumi_create_zip
Expand Down Expand Up @@ -35,10 +36,13 @@
),
)

repo = git.Repo(search_parent_directories=True)
git_sha = repo.head.object.hexsha

function_name = construct_name("cf-ais")
config_values = {
"DB_URL": database.sql_instance_url_with_asyncpg,
"GIT_HASH": git_sha,
}

# The Cloud Function source code itself needs to be zipped up into an
Expand Down

0 comments on commit f74dba6

Please sign in to comment.