Skip to content

Commit

Permalink
Add broadcast status to DB
Browse files Browse the repository at this point in the history
  • Loading branch information
robertdstein committed May 15, 2024
1 parent da49e55 commit fc3af63
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
11 changes: 9 additions & 2 deletions mirar/pipelines/winter/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,9 @@
),
]

# configure to broadcast to IPAC
BROADCAST_BOOL = str(os.getenv("BROADCAST_AVRO", None)) in ["True", "t", "1", "true"]

avro_broadcast = [
# Filter out low quality candidates
CustomSourceTableModifier(modifier_function=winter_candidate_quality_filterer),
Expand All @@ -793,11 +796,15 @@
output_sub_dir="avro_ipac",
topic_prefix="winter",
base_name="WNTR",
# configure to broadcast to IPAC
broadcast=str(os.getenv("BROADCAST_AVRO", None)) in ["True", "t", "1", "true"],
broadcast=BROADCAST_BOOL,
save_local=True,
avro_schema_path=winter_avro_schema_path,
),
HeaderEditor(edit_keys="sent", values=BROADCAST_BOOL),
DatabaseSourceInserter(
db_table=Candidate,
duplicate_protocol="fail",
),
SourceWriter(output_dir_name="preskyportal"),
]

Expand Down
3 changes: 3 additions & 0 deletions mirar/pipelines/winter/models/_candidates.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class CandidatesTable(WinterBase): # pylint: disable=too-few-public-methods
deprecated = Column(Boolean, nullable=False, default=False)
jd = Column(Float, nullable=False)
utctime = Column(DateTime(timezone=True))
sent = Column(Boolean, nullable=False, default=False)

# Image properties

Expand Down Expand Up @@ -224,6 +225,8 @@ class Candidate(BaseDB):
jd: float = Field(ge=0)
utctime: datetime = Field()

sent: bool = Field(default=False)

diffid: int | None = Field(ge=0, default=None)
stackid: int = Field(ge=0)

Expand Down

0 comments on commit fc3af63

Please sign in to comment.