Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tango
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LOFAR2.0
tango
Merge requests
!925
Improving event subscription interface
Code
Review changes
Check out branch
Open in Workspace
Download
Patches
Plain diff
Merged
Improving event subscription interface
enhance-event-subscription-api
into
master
Overview
2
Commits
14
Pipelines
0
Changes
8
Merged
Jan David Mol
requested to merge
enhance-event-subscription-api
into
master
1 year ago
Overview
2
Commits
14
Pipelines
0
Changes
8
Expand
0
0
Merge request reports
Compare
master
version 15
1db34d71
1 year ago
version 14
46043381
1 year ago
version 13
5c355d37
1 year ago
version 12
873f6b8c
1 year ago
version 11
30a2bbbd
1 year ago
version 10
1e41d4cb
1 year ago
version 9
50afedb6
1 year ago
version 8
f1a90c31
1 year ago
version 7
2e7a2513
1 year ago
version 6
a982974c
1 year ago
version 5
9750e8e7
1 year ago
version 4
3f471d21
1 year ago
version 3
90c9e687
1 year ago
version 2
9a602398
1 year ago
version 1
813bd133
1 year ago
master (base)
and
latest version
latest version
382201cb
14 commits,
1 year ago
version 15
1db34d71
16 commits,
1 year ago
version 14
46043381
15 commits,
1 year ago
version 13
5c355d37
14 commits,
1 year ago
version 12
873f6b8c
13 commits,
1 year ago
version 11
30a2bbbd
12 commits,
1 year ago
version 10
1e41d4cb
11 commits,
1 year ago
version 9
50afedb6
10 commits,
1 year ago
version 8
f1a90c31
9 commits,
1 year ago
version 7
2e7a2513
8 commits,
1 year ago
version 6
a982974c
7 commits,
1 year ago
version 5
9750e8e7
6 commits,
1 year ago
version 4
3f471d21
4 commits,
1 year ago
version 3
90c9e687
3 commits,
1 year ago
version 2
9a602398
2 commits,
1 year ago
version 1
813bd133
1 commit,
1 year ago
8 files
+
231
−
59
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
8
Search (e.g. *.vue) (Ctrl+P)
tangostationcontrol/tangostationcontrol/common/events/change_events.py
+
13
−
3
Options
# Copyright (C) 2024 ASTRON (Netherlands Institute for Radio Astronomy)
# SPDX-License-Identifier: Apache-2.0
from
typing
import
Dict
import
numpy
from
tangostationcontrol.common.case_insensitive_string
import
CaseInsensitiveString
from
tangostationcontrol.common.case_insensitive_dict
import
CaseInsensitiveDict
from
tango.server
import
Device
@@ -17,7 +17,15 @@ class ChangeEvents:
def
__init__
(
self
,
device
:
Device
):
self
.
device
=
device
self
.
prev_values
:
Dict
[
str
,
object
]
=
{}
# keep track of which attributes we manage
self
.
attributes
:
list
[
CaseInsensitiveString
]
=
[]
# previous values of attributes, to avoid
# emitting CHANGE_EVENTs when nothing changed.
self
.
prev_values
:
CaseInsensitiveDict
[
str
,
object
]
=
{}
def
is_configured
(
self
,
attr_name
:
str
)
->
bool
:
return
attr_name
in
self
.
attributes
def
configure_attribute
(
self
,
attr_name
:
str
):
"""
Prepares an attribute for emitting custom change events.
"""
@@ -33,6 +41,8 @@ class ChangeEvents:
# so detecting it ourselves is easier.
self
.
device
.
set_change_event
(
attr_name
,
True
,
False
)
self
.
attributes
.
append
(
CaseInsensitiveString
(
attr_name
))
def
send_change_event
(
self
,
attr_name
:
str
,
value
:
object
|
None
):
"""
Emits a CHANGE_EVENT if the attribute has changed value.
"""
Loading