Skip to content

Sender should deduplicate alerts #886

@wk9874

Description

@wk9874

Description of Bug

In offline mode, if you define multiple of the same alert, these are sent to the server first, and you get back the same online ID for all identical offline IDs. If you then send the run, itll swap all offline IDs for the same online ID, which means you have a list of the same IDs. The server then throws a 'duplicate run IDs' error, and the run doesnt get created

Steps To Reproduce

Code to reproduce the behavior:

from simvue import Run
import simvue.sender as sender
if __name__ == "__main__":         
    with Run(mode='offline') as run:
        run.init()
        for i in range(5):
            _ta_id = run.create_metric_threshold_alert(
                name='test_alert',
                frequency=1,
                rule='is below',
                threshold=1,
                metric='metric_counter',
                window=2
            )
            
    sender.sender()

Expected behavior

Alerts should be deduplicated, run should be created with one alert

Actual Behaviour

Run isnt created and throws back an error

Screenshots

If applicable, add screenshots to help explain your problem.

Setup

  • OS: Ubuntu
  • Python version: 3.10

Additional context

Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpythonPull requests that update python code

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions