Skip to content

Conversation

@hernandezc1
Copy link
Collaborator

@hernandezc1 hernandezc1 commented Oct 7, 2025

Summary of Changes

Changed

  • Cloud Run services use pittgoogle-client>=0.3.19
  • Defined functions in broker/cloud_run/lsst/ps_to_storage/main.py to generate lite alerts before they are published to lsst-lite
  • broker/setup_broker/lsst/setup_broker.sh
    • remove ps_lsst_lite_smt.yaml from ps_topic_alerts_lite
  • Updated the UDF in the following SMT files to prevent loss of data precision
    • ps_lsst_flatten_schema_smt.yaml and ps_lsst_add_top_level_fields_smt.yaml
  • Updated the description for the field diaSourceId in value added BigQuery table schemas
    • This field matches the description for the field diaSource.diaSourceId in the alert packet schema
  • ps_input_subscription for our value added modules are now configured with exponential backoffs for delivery failures
    • "While using exponential backoff, Pub/Sub continues to deliver other messages, even if previous messages received negative acknowledgments (unless, you're using ordered message delivery)."

Removed

  • broker/setup_broker/lsst/templates/ps_lsst_lite_smt.yaml

@hernandezc1 hernandezc1 self-assigned this Oct 7, 2025
@hernandezc1 hernandezc1 added the Bug Something isn't working label Oct 7, 2025
@hernandezc1 hernandezc1 changed the title Update LSST SMTs Update SMT UDFs for LSST modules Oct 7, 2025
@hernandezc1 hernandezc1 requested a review from troyraen October 7, 2025 15:21
Copy link
Collaborator

@troyraen troyraen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Comment on lines +95 to +97
--max-delivery-attempts=5 \
--min-retry-delay=10 \
--max-retry-delay=600
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point, double check that the combination of these three flags does what you expect.

)


def _process_field(original_value: Any, config: dict) -> Any:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this really accept and return Any type? Looks to me like it only handles dict | (list[dict] | None).

Comment on lines +32 to +35
LITE_FIELDS_CONFIG = {
"diaSource": {
"fields": {
"diaSourceId",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine for now, but it would be great to define this in a yaml file in pittgoogle-client instead. _create_lite_alert() could move there too.

const attrs = message.attributes || {};
function addTopLevelFields(message, metadata) {
const attrs = message.attributes || {};
const dataStr = message.data.toString();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does toString() have any effect on the data that comes out?

Comment on lines 12 to 15
// We avoid casting fields as JavaScript numbers to prevent precision loss
if (attrs.healpix9) newFields.healpix9 = attrs.healpix9.toString();
if (attrs.healpix19) newFields.healpix19 = attrs.healpix19.toString();
if (attrs.healpix29) newFields.healpix29 = attrs.healpix29.toString();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does javascript really not support 64bit ints? That seems strange. If leaving toString(), does that mean these will be strings in the output data? That would be a pain for everyone downstream.

Comment on lines 17 to 19
diaSourceId: attrs.diaSource_diaSourceId ? attrs.diaSource_diaSourceId.toString() : null,
diaObjectId: attrs.diaObject_diaObjectId ? attrs.diaObject_diaObjectId.toString() : null,
ssObjectId: attrs.ssSource_ssObjectId ? attrs.ssSource_ssObjectId.toString() : null,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same concern about toString() here.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add comments at the tops of these SMT yaml files briefly explaining what the transforms do and where there are intended to be used.

Also, minor, but I would name these files like ps_smt_lsst_add_top_level_fields.yaml or just smt_lsst_add_top_level_fields.yaml so "smt" is closer to the beginning. Also, 'lsst' could probably be removed since these are underneath an 'lsst' directory.

if (attrs.healpix19) newFields.healpix19 = attrs.healpix19.toString();
if (attrs.healpix29) newFields.healpix29 = attrs.healpix29.toString();
if (attrs["kafka.timestamp"]) {
newFields.kafkaPublishTimestamp = attrs["kafka.timestamp"] * 1000;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'kafka.timestamp * 1000' is happening in several places (2 in this PR and I think I saw it somewhere else when you were screensharing earlier today). Is it necessary? If so, leave a comment explaining why.

Also consider whether a user could be easily confused when comparing the data that comes out of a '* 1000' operation with data from the same alert that hasn't undergone '* 1000'. In most cases I'm aware of where a '* 1000' operation is necessary, the transformation results in output data will not be confusing (e.g., the output is a python datetime object, so not a float like 'kafka.timestamp' is and thus not confusing). I don't know what the output data looks like here, which is why I suggest considering it. If it is both necessary and confusing, what to do about that is probably a case-by-case decision.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants