Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
flamenco-worker-python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
blender
flamenco-worker-python
Commits
08fb679b
Commit
08fb679b
authored
8 years ago
by
Sybren A. Stüvel
Browse files
Options
Downloads
Patches
Plain Diff
Manager: fixed issue with TaskTimeoutChecker not killing un-pinged tasks
parent
617a08fa
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
packages/flamenco-manager-go/src/flamenco-manager/flamenco/task_timeout_check.go
+22
-11
22 additions, 11 deletions
...er-go/src/flamenco-manager/flamenco/task_timeout_check.go
with
22 additions
and
11 deletions
packages/flamenco-manager-go/src/flamenco-manager/flamenco/task_timeout_check.go
+
22
−
11
View file @
08fb679b
...
...
@@ -10,7 +10,6 @@ import (
log
"github.com/Sirupsen/logrus"
mgo
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)
// Interval for checking all active tasks for timeouts.
...
...
@@ -46,6 +45,7 @@ func (self *TaskTimeoutChecker) Go() {
ok
:=
KillableSleep
(
"TaskTimeoutChecker-initial"
,
TASK_TIMEOUT_CHECK_INITIAL_SLEEP
,
self
.
done_chan
,
self
.
done_wg
)
if
!
ok
{
log
.
Warningf
(
"TaskTimeoutChecker: Killable sleep was killed, not even starting checker."
)
return
}
...
...
@@ -67,14 +67,18 @@ func (self *TaskTimeoutChecker) Close() {
func
(
self
*
TaskTimeoutChecker
)
check
(
db
*
mgo
.
Database
)
{
timeout_threshold
:=
UtcNow
()
.
Add
(
-
self
.
config
.
ActiveTaskTimeoutInterval
)
//
log.
Info
f("Failing all active tasks that have not been touched since %s", timeout_threshold)
log
.
Debug
f
(
"Failing all active tasks that have not been touched since %s"
,
timeout_threshold
)
var
timedout_tasks
[]
Task
query
:=
bson
.
M
{
"status"
:
"active"
,
"last_worker_ping"
:
bson
.
M
{
"$lte"
:
timeout_threshold
},
// find all active tasks that either have never been pinged, or were pinged long ago.
query
:=
M
{
"status"
:
"active"
,
"$or"
:
[]
M
{
M
{
"last_worker_ping"
:
M
{
"$lte"
:
timeout_threshold
}},
M
{
"last_worker_ping"
:
M
{
"$exists"
:
false
}},
},
}
projection
:=
bson
.
M
{
projection
:=
M
{
"_id"
:
1
,
"last_worker_ping"
:
1
,
"worker_id"
:
1
,
...
...
@@ -86,16 +90,23 @@ func (self *TaskTimeoutChecker) check(db *mgo.Database) {
for
_
,
task
:=
range
timedout_tasks
{
log
.
Warningf
(
" - Task %s (%s) timed out"
,
task
.
Name
,
task
.
Id
.
Hex
())
var
ident
string
if
task
.
Worker
!=
""
{
ident
=
task
.
Worker
}
else
if
task
.
WorkerId
!=
nil
{
ident
=
task
.
WorkerId
.
Hex
()
}
else
{
ident
=
"-no worker-"
}
tupdate
:=
TaskUpdate
{
TaskId
:
task
.
Id
,
TaskStatus
:
"failed"
,
Activity
:
fmt
.
Sprintf
(
"Task timed out on worker %s (%s)"
,
task
.
Worker
,
task
.
WorkerId
.
Hex
()),
Activity
:
fmt
.
Sprintf
(
"Task timed out on worker %s"
,
ident
),
Log
:
fmt
.
Sprintf
(
"%s Task %s (%s) timed out, was active but untouched since %s. "
+
"Was handled by worker %s (%s)"
,
UtcNow
(),
task
.
Name
,
task
.
Id
.
Hex
(),
task
.
LastWorkerPing
,
task
.
Worker
,
task
.
WorkerId
.
Hex
()),
"Was handled by worker %s"
,
UtcNow
(),
task
.
Name
,
task
.
Id
.
Hex
(),
task
.
LastWorkerPing
,
ident
),
}
QueueTaskUpdate
(
&
tupdate
,
db
)
}
...
...
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