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
Commits
dc71db82
Commit
dc71db82
authored
1 month ago
by
Hannes Feldt
Browse files
Options
Downloads
Plain Diff
Merge branch 'fix-datetime-issue' into 'master'
Fix datetime issue See merge request
!1070
parents
cab89305
790bef4d
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!1070
Fix datetime issue
Pipeline
#112732
failed
1 month ago
Stage: prepare
Stage: lint
Stage: test
Stage: package
Stage: images
Stage: integration
Stage: deploy
Pipeline: tango
#112734
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
tangostationcontrol/observation/observation_controller.py
+9
-7
9 additions, 7 deletions
tangostationcontrol/observation/observation_controller.py
tests/observation/test_observation_controller.py
+6
-4
6 additions, 4 deletions
tests/observation/test_observation_controller.py
with
15 additions
and
11 deletions
tangostationcontrol/observation/observation_controller.py
+
9
−
7
View file @
dc71db82
# Copyright (C) 202
2
ASTRON (Netherlands Institute for Radio Astronomy)
#
Copyright (C) 202
5
ASTRON (Netherlands Institute for Radio Astronomy)
# SPDX-License-Identifier: Apache-2.0
from
datetime
import
datetime
from
datetime
import
datetime
,
timezone
import
logging
from
typing
import
Callable
,
Type
...
...
@@ -87,10 +87,12 @@ class ObservationController(dict[int, Observation]):
# Check further properties that cannot be validated through a JSON schema
# TODO(Corne): Discuss do we want this?
for
observation_field_settings
in
settings
.
antenna_fields
:
if
(
datetime
.
fromisoformat
(
observation_field_settings
.
stop_time
)
<=
datetime
.
now
()
):
start
=
datetime
.
fromisoformat
(
observation_field_settings
.
stop_time
)
if
not
start
.
tzinfo
:
start
=
start
.
replace
(
tzinfo
=
timezone
.
utc
)
if
start
<=
datetime
.
now
(
timezone
.
utc
):
raise
ValueError
(
"
Cannot start observation
"
f
"
{
observation_field_settings
.
observation_id
}
because antenna
"
...
...
This diff is collapsed.
Click to expand it.
tests/observation/test_observation_controller.py
+
6
−
4
View file @
dc71db82
# Copyright (C) 202
2
ASTRON (Netherlands Institute for Radio Astronomy)
#
Copyright (C) 202
5
ASTRON (Netherlands Institute for Radio Astronomy)
# SPDX-License-Identifier: Apache-2.0
import
copy
from
datetime
import
datetime
,
timedelta
from
datetime
import
datetime
,
timedelta
,
timezone
from
typing
import
Dict
from
typing
import
List
from
unittest
import
mock
...
...
@@ -128,7 +128,9 @@ class TestObservationController(base.TestCase):
def
test_add_observation
(
self
,
_m_tango_util
):
settings
=
get_observation_settings_two_fields_core
()
for
antenna_field
in
settings
.
antenna_fields
:
antenna_field
.
stop_time
=
(
datetime
.
now
()
+
timedelta
(
days
=
1
)).
isoformat
()
antenna_field
.
stop_time
=
(
datetime
.
now
(
timezone
.
utc
)
+
timedelta
(
days
=
1
)
).
isoformat
()
sut
=
obs_module
.
ObservationController
(
"
DMR
"
)
...
...
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