Skip to content

Warn users about what will/won't happen if they mutate Alert properties #78

@troyraen

Description

@troyraen

In the Alert class, properties like dict, dataframe, and skymap are mutable but they are not kept in sync if they are altered. This is potentially confusing. We haven't yet run into use cases where this has caused problems but there's nothing stopping folks from altering 2 or 3 of those and then being confused. At a minimum, we should provide some type of warning about what will/won't happen in this case.

For reference:

  • Alert.dict is constructed from Alert.msg.data (which is immutable) the first time it is accessed, then can be mutated.
  • Methods like Alert.get() and Topic.publish() always get the data from Alert.dict.
  • Alert.dataframe and Alert.skymap are constructed from Alert.dict the first time they are accessed, then can be mutated. Mutations to these properties will not propagate to Alert.dict.

It would be nice to propagate changes but implementing that would require a little more thought and then non-trivial work. I made an attempt at this awhile back and tried to use numpy arrays as the fundamental data structure and then have the three relevant properties get their data from there. It turned out to be more work than I had time for at the moment and I abandoned it. I'm not sure that was the best strategy anyway.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions