Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
ensembl-gh-mirror
ensembl-hive
Commits
5c52f484
Commit
5c52f484
authored
Jan 19, 2011
by
Leo Gordon
Browse files
retry 3 times to avoid deadlock situations
parent
07377b4d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
15 deletions
+29
-15
modules/Bio/EnsEMBL/Hive/DBSQL/AnalysisJobAdaptor.pm
modules/Bio/EnsEMBL/Hive/DBSQL/AnalysisJobAdaptor.pm
+29
-15
No files found.
modules/Bio/EnsEMBL/Hive/DBSQL/AnalysisJobAdaptor.pm
View file @
5c52f484
...
...
@@ -394,24 +394,38 @@ sub increase_semaphore_count_for_jobid { # used in semaphore propagation
=cut
sub
update_status
{
my
(
$self
,
$job
)
=
@_
;
my
(
$self
,
$job
)
=
@_
;
my
$sql
=
"
UPDATE analysis_job SET status='
"
.
$job
->
status
.
"
'
";
my
$sql
=
"
UPDATE analysis_job SET status='
"
.
$job
->
status
.
"
'
";
if
(
$job
->
status
eq
'
DONE
')
{
$sql
.=
"
,completed=now()
";
$sql
.=
"
,runtime_msec=
"
.
$job
->
runtime_msec
;
$sql
.=
"
,query_count=
"
.
$job
->
query_count
;
}
elsif
(
$job
->
status
eq
'
PASSED_ON
')
{
$sql
.=
"
, completed=now()
";
}
elsif
(
$job
->
status
eq
'
READY
')
{
}
if
(
$job
->
status
eq
'
DONE
')
{
$sql
.=
"
,completed=now()
";
$sql
.=
"
,runtime_msec=
"
.
$job
->
runtime_msec
;
$sql
.=
"
,query_count=
"
.
$job
->
query_count
;
}
elsif
(
$job
->
status
eq
'
PASSED_ON
')
{
$sql
.=
"
, completed=now()
";
}
elsif
(
$job
->
status
eq
'
READY
')
{
}
$sql
.=
"
WHERE analysis_job_id='
"
.
$job
->
dbID
.
"
'
";
my
$sth
=
$self
->
prepare
(
$sql
);
$sth
->
execute
();
$sth
->
finish
;
$sql
.=
"
WHERE analysis_job_id='
"
.
$job
->
dbID
.
"
'
";
# This particular query is infamous for collisions and 'deadlock' situations; let's make them wait and retry.
foreach
(
0
..
3
)
{
eval
{
my
$sth
=
$self
->
prepare
(
$sql
);
$sth
->
execute
();
$sth
->
finish
;
1
;
}
or
do
{
if
(
$@
=~
/Deadlock found when trying to get lock; try restarting transaction/
)
{
# ignore this particular error
sleep
1
;
next
;
}
die
$@
;
# but definitely report other errors
};
last
;
}
die
"
After 3 retries still in a deadlock: $@
"
if
(
$@
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment