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
ff88f407
Commit
ff88f407
authored
Nov 30, 2023
by
Jan David Mol
Browse files
Options
Downloads
Patches
Plain Diff
L2SS-1633
: Sync IERS tables through minio.
parent
8668e88b
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!785
L2SS-1633: Sync IERS tables through minio.
Changes
22
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
tangostationcontrol/tangostationcontrol/devices/base_device_classes/lofar_device.py
+11
-0
11 additions, 0 deletions
...tationcontrol/devices/base_device_classes/lofar_device.py
tangostationcontrol/test/common/test_measures.py
+0
-74
0 additions, 74 deletions
tangostationcontrol/test/common/test_measures.py
with
11 additions
and
74 deletions
tangostationcontrol/tangostationcontrol/devices/base_device_classes/lofar_device.py
+
11
−
0
View file @
ff88f407
...
...
@@ -28,6 +28,7 @@ from tango.server import attribute, command, Device, device_property
# Additional import
from
tangostationcontrol
import
__version__
as
version
from
tangostationcontrol.common.device_decorators
import
only_in_states
,
fault_on_error
from
tangostationcontrol.common.entrypoint
import
restart_python
from
tangostationcontrol.common.lofar_logging
import
log_exceptions
from
tangostationcontrol.common.proxy
import
create_device_proxy
from
tangostationcontrol.common.states
import
(
...
...
@@ -583,6 +584,16 @@ class LOFARDevice(Device):
self
.
set_state
(
DevState
.
DISABLE
)
self
.
set_status
(
"
Device is in the DISABLE state.
"
)
@command
()
@DebugIt
()
@log_exceptions
()
def
restart_device_server
(
self
):
"""
Restart the device server. Needed to reload casacore, and maybe for nasty bugs.
"""
logger
.
warning
(
"
Restarting Device Server
"
)
restart_python
()
logger
.
error
(
"
Failed to restart Device Server
"
)
@only_in_states
(
DEFAULT_COMMAND_STATES
)
@fault_on_error
()
@command
()
...
...
This diff is collapsed.
Click to expand it.
tangostationcontrol/test/common/test_measures.py
deleted
100644 → 0
+
0
−
74
View file @
8668e88b
# Copyright (C) 2022 ASTRON (Netherlands Institute for Radio Astronomy)
# SPDX-License-Identifier: Apache-2.0
import
os.path
import
shutil
import
tempfile
import
urllib.request
from
unittest
import
mock
from
tangostationcontrol.common
import
measures
from
test
import
base
# where our WSRT_Measures.ztar surrogate is located
# two versions with different timestamps are provided
FAKE_MEASURES
=
os
.
path
.
dirname
(
__file__
)
+
"
/fake_measures.ztar
"
FAKE_MEASURES_NEWER
=
os
.
path
.
dirname
(
__file__
)
+
"
/fake_measures_newer.ztar
"
class
TestMeasures
(
base
.
TestCase
):
@mock.patch.object
(
urllib
.
request
,
"
urlretrieve
"
)
def
test_download_and_use
(
self
,
m_urlretrieve
):
"""
Test downloading and using new measures tables.
"""
with
tempfile
.
TemporaryDirectory
()
as
tmpdirname
,
mock
.
patch
(
"
tangostationcontrol.common.measures.IERS_ROOTDIR
"
,
tmpdirname
)
as
rootdir
,
mock
.
patch
(
"
tangostationcontrol.common.measures.DOWNLOAD_DIR
"
,
tmpdirname
)
as
downloaddir
:
# emulate the download
m_urlretrieve
.
side_effect
=
lambda
*
args
,
**
kw
:
shutil
.
copyfile
(
FAKE_MEASURES
,
tmpdirname
+
"
/WSRT_Measures.ztar
"
)
# 'download' and process our fake measures
newdir
=
measures
.
download_measures
()
# active them
measures
.
use_measures_directory
(
newdir
)
# check if they're activated
self
.
assertIn
(
newdir
,
measures
.
get_available_measures_directories
())
self
.
assertEqual
(
newdir
,
measures
.
get_measures_directory
())
@mock.patch.object
(
urllib
.
request
,
"
urlretrieve
"
)
def
test_switch_tables
(
self
,
m_urlretrieve
):
"""
Test switching between available sets of measures tables.
"""
with
tempfile
.
TemporaryDirectory
()
as
tmpdirname
,
mock
.
patch
(
"
tangostationcontrol.common.measures.IERS_ROOTDIR
"
,
tmpdirname
)
as
rootdir
,
mock
.
patch
(
"
tangostationcontrol.common.measures.DOWNLOAD_DIR
"
,
tmpdirname
)
as
downloaddir
:
# 'download' two measures with different timestamps
m_urlretrieve
.
side_effect
=
lambda
*
args
,
**
kw
:
shutil
.
copyfile
(
FAKE_MEASURES
,
tmpdirname
+
"
/WSRT_Measures.ztar
"
)
newdir1
=
measures
.
download_measures
()
m_urlretrieve
.
side_effect
=
lambda
*
args
,
**
kw
:
shutil
.
copyfile
(
FAKE_MEASURES_NEWER
,
tmpdirname
+
"
/WSRT_Measures.ztar
"
)
newdir2
=
measures
.
download_measures
()
# check if both are available
self
.
assertIn
(
newdir1
,
measures
.
get_available_measures_directories
())
self
.
assertIn
(
newdir2
,
measures
.
get_available_measures_directories
())
# switch between the two
measures
.
use_measures_directory
(
newdir1
)
self
.
assertEqual
(
newdir1
,
measures
.
get_measures_directory
())
measures
.
use_measures_directory
(
newdir2
)
self
.
assertEqual
(
newdir2
,
measures
.
get_measures_directory
())
measures
.
use_measures_directory
(
newdir1
)
self
.
assertEqual
(
newdir1
,
measures
.
get_measures_directory
())
This diff is collapsed.
Click to expand it.
Prev
1
2
Next
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