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
85bed6e9
Commit
85bed6e9
authored
5 years ago
by
Jorrit Schaap
Browse files
Options
Downloads
Patches
Plain Diff
SW-786
: raise ScheduleException upon radb PostgresDBQueryExecutionError
parent
3dc6e613
No related branches found
No related tags found
2 merge requests
!20
Lofar release 4 0 back to master
,
!17
Resolve SW-786
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
SAS/ResourceAssignment/ResourceAssigner/lib/schedulechecker.py
+11
-4
11 additions, 4 deletions
...esourceAssignment/ResourceAssigner/lib/schedulechecker.py
SAS/ResourceAssignment/ResourceAssigner/lib/schedulers.py
+66
-60
66 additions, 60 deletions
SAS/ResourceAssignment/ResourceAssigner/lib/schedulers.py
with
77 additions
and
64 deletions
SAS/ResourceAssignment/ResourceAssigner/lib/schedulechecker.py
+
11
−
4
View file @
85bed6e9
...
...
@@ -72,9 +72,11 @@ def movePipelineAfterItsPredecessors(task, radbrpc, min_start_timestamp=None):
if
shift
!=
timedelta
(
seconds
=
0
):
logger
.
info
(
"
Moving %s pipeline radb_id=%s otdb_id=%s by %s from
\'
%s
\'
to
\'
%s
\'
"
,
task
[
'
status
'
],
task
[
'
id
'
],
task
[
'
otdb_id
'
],
format_timedelta
(
shift
),
task
[
'
starttime
'
],
newStartTime
)
if
not
radbrpc
.
updateTaskAndResourceClaims
(
task
[
'
id
'
],
starttime
=
newStartTime
,
endtime
=
newEndTime
):
logger
.
warning
(
"
Could not update start/endtime for pipeline radb_id=%s otdb_id=%s
"
,
updated_task
[
'
id
'
],
updated_task
[
'
otdb_id
'
])
try
:
radbrpc
.
updateTaskAndResourceClaims
(
task
[
'
id
'
],
starttime
=
newStartTime
,
endtime
=
newEndTime
)
except
Exception
as
e
:
logger
.
warning
(
"
Could not update start/endtime for pipeline radb_id=%s otdb_id=%s error: %s
"
,
task
[
'
id
'
],
task
[
'
otdb_id
'
],
e
)
updated_task
=
radbrpc
.
getTask
(
task
[
'
id
'
])
...
...
@@ -143,7 +145,12 @@ class ScheduleChecker():
if
task
[
'
endtime
'
]
<=
now
:
new_endtime
=
now
+
timedelta
(
seconds
=
PIPELINE_CHECK_INTERVAL
)
logger
.
info
(
"
Extending endtime to %s for pipeline radb_id=%s otdb_id=%s
"
,
new_endtime
,
task
[
'
id
'
],
task
[
'
otdb_id
'
])
try
:
self
.
_radbrpc
.
updateTaskAndResourceClaims
(
task
[
'
id
'
],
endtime
=
new_endtime
)
except
Exception
as
e
:
logger
.
error
(
"
Could not extend endtime to %s for pipeline radb_id=%s otdb_id=%s error: %s
"
,
new_endtime
,
task
[
'
id
'
],
task
[
'
otdb_id
'
],
e
)
except
Exception
as
e
:
logger
.
error
(
"
Error while checking running pipelines: %s
"
,
e
)
...
...
This diff is collapsed.
Click to expand it.
SAS/ResourceAssignment/ResourceAssigner/lib/schedulers.py
+
66
−
60
View file @
85bed6e9
...
...
@@ -4,7 +4,7 @@ from copy import deepcopy
from
lofar.common.cache
import
cache
from
lofar.messaging
import
DEFAULT_BROKER
,
DEFAULT_BUSNAME
from
lofar.sas.resourceassignment.database.radb
import
RADatabase
from
lofar.sas.resourceassignment.database.radb
import
RADatabase
,
PostgresDBQueryExecutionError
from
lofar.mom.momqueryservice.momqueryrpc
import
MoMQueryRPC
...
...
@@ -153,8 +153,11 @@ class BasicScheduler(object):
logger
.
debug
(
"
BasicScheduler: _post_process_allocation for task %s
"
,
self
.
task_id
)
# move all claims from tentative -> claimed
try
:
if
not
self
.
radb
.
updateResourceClaims
(
where_task_ids
=
[
self
.
task_id
],
status
=
"
claimed
"
,
commit
=
False
):
raise
ScheduleException
(
"
Failed to put tentative claims to claimed
"
)
except
PostgresDBQueryExecutionError
as
e
:
raise
ScheduleException
(
"
Failed to put tentative claims to claimed. error: %s
"
%
(
e
,))
changed_tasks
=
[]
#Not used in the BasicScheduler, but in derived schedulers it is
return
changed_tasks
...
...
@@ -234,6 +237,7 @@ class BasicScheduler(object):
:raises ScheduleException if it could not schedule the resources due to conflicts
"""
try
:
logger
.
debug
(
"
Requested resources: %s
"
,
requested_resources
)
logger
.
debug
(
"
Available resources: %s
"
,
available_resources
)
...
...
@@ -294,6 +298,8 @@ class BasicScheduler(object):
logger
.
info
(
"
Remaining estimates: %s
"
,
remaining_estimates
)
return
remaining_estimates
except
PostgresDBQueryExecutionError
as
e
:
raise
ScheduleException
(
"
Error while scheduling resources: %s
"
%
(
e
,))
def
_resolve_conflict
(
self
,
conflict_claim
):
"""
Resolve one conflict, making it is useful to try to schedule again.
...
...
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