Skip to content
GitLab
Explore
Sign in
Register
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
afa92a8a
Commit
afa92a8a
authored
4 years ago
by
Jörn Künsemöller
Browse files
Options
Downloads
Patches
Plain Diff
TMSS-221
: allow empty scheduling units so that tests pass
parent
ae092265
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!186
Resolve TMSS-221
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
SAS/TMSS/src/tmss/tmssapp/models/specification.py
+20
-4
20 additions, 4 deletions
SAS/TMSS/src/tmss/tmssapp/models/specification.py
with
20 additions
and
4 deletions
SAS/TMSS/src/tmss/tmssapp/models/specification.py
+
20
−
4
View file @
afa92a8a
...
...
@@ -314,13 +314,21 @@ class SchedulingUnitDraft(NamedCommon):
def
relative_start_time
(
self
)
->
datetime
.
timedelta
:
'''
return the earliest relative start time of all tasks of this scheduling unit
'''
return
min
(
self
.
task_drafts
.
all
(),
key
=
lambda
x
:
x
.
relative_start_time
).
relative_start_time
task_drafts
=
list
(
self
.
task_drafts
.
all
())
if
task_drafts
:
return
min
(
task_drafts
,
key
=
lambda
x
:
x
.
relative_start_time
).
relative_start_time
else
:
return
datetime
.
timedelta
(
seconds
=
0
)
@property
def
relative_stop_time
(
self
)
->
datetime
.
timedelta
:
'''
return the latest relative stop time of all tasks of this scheduling unit
'''
return
max
(
self
.
task_drafts
.
all
(),
key
=
lambda
x
:
x
.
relative_stop_time
).
relative_stop_time
task_drafts
=
list
(
self
.
task_drafts
.
all
())
if
task_drafts
:
return
max
(
task_drafts
,
key
=
lambda
x
:
x
.
relative_stop_time
).
relative_stop_time
else
:
return
datetime
.
timedelta
(
seconds
=
0
)
class
SchedulingUnitBlueprint
(
NamedCommon
):
...
...
@@ -348,13 +356,21 @@ class SchedulingUnitBlueprint(NamedCommon):
def
relative_start_time
(
self
)
->
datetime
.
timedelta
:
'''
return the earliest relative start time of all tasks of this scheduling unit
'''
return
min
(
self
.
task_blueprints
.
all
(),
key
=
lambda
x
:
x
.
relative_start_time
).
relative_start_time
task_blueprints
=
list
(
self
.
task_blueprints
.
all
())
if
task_blueprints
:
return
min
(
task_blueprints
,
key
=
lambda
x
:
x
.
relative_start_time
).
relative_start_time
else
:
return
datetime
.
timedelta
(
seconds
=
0
)
@property
def
relative_stop_time
(
self
)
->
datetime
.
timedelta
:
'''
return the latest relative stop time of all tasks of this scheduling unit
'''
return
max
(
self
.
task_blueprints
.
all
(),
key
=
lambda
x
:
x
.
relative_stop_time
).
relative_stop_time
task_blueprints
=
list
(
self
.
task_blueprints
.
all
())
if
task_blueprints
:
return
max
(
task_blueprints
,
key
=
lambda
x
:
x
.
relative_stop_time
).
relative_stop_time
else
:
return
datetime
.
timedelta
(
seconds
=
0
)
@property
def
start_time
(
self
)
->
datetime
or
None
:
...
...
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