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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LOFAR2.0
tango
Commits
77857a80
Commit
77857a80
authored
2 years ago
by
Stefano Di Frischia
Browse files
Options
Downloads
Patches
Plain Diff
L2SS-1264
: remove thread entries
parent
5d0a029a
No related branches found
No related tags found
1 merge request
!559
Draft: L2SS-1264: create async lofar device
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tangostationcontrol/tangostationcontrol/devices/interfaces/beam_device.py
+9
-14
9 additions, 14 deletions
...rol/tangostationcontrol/devices/interfaces/beam_device.py
with
9 additions
and
14 deletions
tangostationcontrol/tangostationcontrol/devices/interfaces/beam_device.py
+
9
−
14
View file @
77857a80
...
@@ -8,7 +8,6 @@
...
@@ -8,7 +8,6 @@
from
json
import
loads
from
json
import
loads
from
statistics
import
median
from
statistics
import
median
# from threading import Thread, Lock, Condition
import
asyncio
import
asyncio
from
typing
import
Callable
from
typing
import
Callable
import
datetime
import
datetime
...
@@ -547,7 +546,7 @@ class BeamTracker:
...
@@ -547,7 +546,7 @@ class BeamTracker:
""""""
""""""
self
.
done
=
False
self
.
done
=
False
self
.
thread
=
None
self
.
loop
=
None
self
.
interval
=
interval
self
.
interval
=
interval
self
.
preparation_time
=
preparation_time
self
.
preparation_time
=
preparation_time
...
@@ -556,8 +555,6 @@ class BeamTracker:
...
@@ -556,8 +555,6 @@ class BeamTracker:
self
.
fault_callback
=
fault_callback
self
.
fault_callback
=
fault_callback
# Condition to trigger a forced update or early abort
# Condition to trigger a forced update or early abort
# self.update_lock = Lock()
# self.update_condition = Condition(self.update_lock)
self
.
update_lock
=
asyncio
.
Lock
()
self
.
update_lock
=
asyncio
.
Lock
()
self
.
update_condition
=
asyncio
.
Condition
(
self
.
update_lock
)
self
.
update_condition
=
asyncio
.
Condition
(
self
.
update_lock
)
...
@@ -571,20 +568,18 @@ class BeamTracker:
...
@@ -571,20 +568,18 @@ class BeamTracker:
async
def
start
(
self
):
async
def
start
(
self
):
"""
Starts the Beam Tracking thread
"""
"""
Starts the Beam Tracking thread
"""
if
self
.
thread
:
if
self
.
loop
:
# already started
# already started
return
return
# self.thread = Thread(target=self._update_pointing_direction, name="BeamTracker")
self
.
loop
=
asyncio
.
get_event_loop
()
# self.thread.start()
self
.
loop
.
create_task
(
self
.
_update_pointing_direction
())
loop
=
asyncio
.
get_event_loop
()
loop
.
create_task
(
self
.
_update_pointing_direction
())
logger
.
info
(
"
[BeamTracking] Thread started
"
)
logger
.
info
(
"
[BeamTracking] Thread started
"
)
async
def
is_alive
(
self
)
->
bool
:
async
def
is_alive
(
self
)
->
bool
:
"""
True just before and after run method starts and terminates
"""
"""
True just before and after run method starts and terminates
"""
return
self
.
thread
and
self
.
thread
.
is_alive
()
return
self
.
loop
and
(
self
.
_update_pointing_direction
()
in
asyncio
.
all_tasks
()
)
async
def
force_update
(
self
):
async
def
force_update
(
self
):
"""
Force the pointing to be updated.
"""
"""
Force the pointing to be updated.
"""
...
@@ -600,21 +595,21 @@ class BeamTracker:
...
@@ -600,21 +595,21 @@ class BeamTracker:
async
def
stop
(
self
):
async
def
stop
(
self
):
"""
Stops the Beam Tracking loop
"""
"""
Stops the Beam Tracking loop
"""
if
not
self
.
thread
:
if
not
self
.
loop
:
return
return
logger
.
info
(
"
[BeamTracking] Thread stopping
"
)
logger
.
info
(
"
[BeamTracking] Thread stopping
"
)
self
.
done
=
True
self
.
done
=
True
self
.
force_update
()
await
self
.
force_update
()
# wait for thread to finish
# wait for thread to finish
self
.
thread
.
join
(
self
.
DISCONNECT_TIMEOUT
)
self
.
loop
.
run_until_complete
(
self
.
_update_pointing_direction
()
)
if
self
.
is_alive
():
if
self
.
is_alive
():
logger
.
error
(
"
[BeamTracking] Thread did not properly terminate
"
)
logger
.
error
(
"
[BeamTracking] Thread did not properly terminate
"
)
self
.
thread
=
None
self
.
loop
=
None
logger
.
info
(
"
[BeamTracking] Thread stopped
"
)
logger
.
info
(
"
[BeamTracking] Thread stopped
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment