Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review 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
RadioObservatory
LOFAR
Commits
39a8720b
Commit
39a8720b
authored
4 years ago
by
Jorrit Schaap
Browse files
Options
Downloads
Patches
Plain Diff
TMSS-207
: handling of start/stop times
parent
6d62f7e2
No related branches found
No related tags found
1 merge request
!162
Intermediate merge of TMSS-207 to master
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
SAS/TMSS/src/tmss/tmssapp/models/scheduling.py
+10
-3
10 additions, 3 deletions
SAS/TMSS/src/tmss/tmssapp/models/scheduling.py
with
10 additions
and
3 deletions
SAS/TMSS/src/tmss/tmssapp/models/scheduling.py
+
10
−
3
View file @
39a8720b
...
...
@@ -6,6 +6,8 @@ import os
import
logging
logger
=
logging
.
getLogger
(
__name__
)
from
datetime
import
datetime
,
timedelta
from
django.db.models
import
ForeignKey
,
CharField
,
DateTimeField
,
BooleanField
,
IntegerField
,
BigIntegerField
,
\
ManyToManyField
,
CASCADE
,
SET_NULL
,
PROTECT
,
UniqueConstraint
,
QuerySet
from
django.contrib.postgres.fields
import
ArrayField
,
JSONField
...
...
@@ -204,9 +206,14 @@ class Subtask(BasicCommon):
validate_json_against_schema
(
self
.
specifications_doc
,
self
.
specifications_template
.
schema
)
if
self
.
state
.
value
==
SubtaskState
.
Choices
.
SCHEDULED
.
value
and
self
.
__original_state
.
value
==
SubtaskState
.
Choices
.
SCHEDULING
.
value
:
if
self
.
start_time
is
None
or
self
.
stop_time
is
None
:
raise
SubtaskSchedulingException
(
"
Cannot schedule subtask id=%s when start/stop times are NULL. start_time=
'
%s
'
stoptime=
'
%s
'"
%
(
self
.
pk
,
formatDatetime
(
self
.
start_time
),
formatDatetime
(
self
.
stop_time
)))
if
self
.
start_time
is
None
:
if
self
.
predecessors
.
all
().
count
()
is
0
:
raise
SubtaskSchedulingException
(
"
Cannot schedule subtask id=%s when start time is
'
None
'
.
"
%
(
self
.
pk
,
))
else
:
self
.
start_time
=
datetime
.
utcnow
()
if
self
.
state
.
value
==
SubtaskState
.
Choices
.
FINISHING
.
value
:
self
.
stop_time
=
datetime
.
utcnow
()
super
().
save
(
force_insert
,
force_update
,
using
,
update_fields
)
...
...
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