Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ensembl-gh-mirror
ensembl-hive
Commits
68bf9ff4
Commit
68bf9ff4
authored
Jun 14, 2004
by
Jessica Severin
Browse files
added beekeeper tag to aid in tracking dead workers
parent
9196a58a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
8 deletions
+40
-8
modules/Bio/EnsEMBL/Hive/Queen.pm
modules/Bio/EnsEMBL/Hive/Queen.pm
+7
-1
modules/Bio/EnsEMBL/Hive/Worker.pm
modules/Bio/EnsEMBL/Hive/Worker.pm
+5
-0
scripts/local_beekeeper.pl
scripts/local_beekeeper.pl
+27
-7
sql/tables.sql
sql/tables.sql
+1
-0
No files found.
modules/Bio/EnsEMBL/Hive/Queen.pm
View file @
68bf9ff4
...
...
@@ -81,7 +81,9 @@ our @ISA = qw(Bio::EnsEMBL::DBSQL::BaseAdaptor);
=cut
sub
create_new_worker
{
my
(
$self
,
$analysis_id
)
=
@_
;
my
$self
=
shift
;
my
$analysis_id
=
shift
;
my
$beekeeper
=
shift
;
my
$analStatsDBA
=
$self
->
_analysisStatsAdaptor
;
return
undef
unless
(
$analStatsDBA
);
...
...
@@ -101,10 +103,12 @@ sub create_new_worker {
my
$host
=
hostname
;
my
$ppid
=
getppid
;
$beekeeper
=
''
unless
(
$beekeeper
);
my
$sql
=
"
INSERT INTO hive SET born=now(), last_check_in=now()
"
.
"
,process_id='
$ppid
'
"
.
"
,analysis_id='
$analysis_id
'
"
.
"
,beekeeper='
$beekeeper
'
"
.
"
,host='
$host
'
";
my
$sth
=
$self
->
prepare
(
$sql
);
...
...
@@ -410,6 +414,7 @@ sub _columns {
return
qw (h.hive_id
h
.
analysis_id
h
.
beekeeper
h
.
host
h
.
process_id
h
.
work_done
...
...
@@ -433,6 +438,7 @@ sub _objs_from_sth {
$worker
->
init
;
$worker
->
hive_id
(
$column
{'
hive_id
'});
$worker
->
beekeeper
(
$column
{'
beekeeper
'});
$worker
->
host
(
$column
{'
host
'});
$worker
->
process_id
(
$column
{'
process_id
'});
$worker
->
work_done
(
$column
{'
work_done
'});
...
...
modules/Bio/EnsEMBL/Hive/Worker.pm
View file @
68bf9ff4
...
...
@@ -87,6 +87,11 @@ sub db {
$self
->
{'
_db
'}
=
shift
if
(
@
_
);
return
$self
->
{'
_db
'};
}
sub
beekeeper
{
my
$self
=
shift
;
$self
->
{'
_beekeeper
'}
=
shift
if
(
@
_
);
return
$self
->
{'
_beekeeper
'};
}
=head2 analysis
Arg [1] : (optional) Bio::EnsEMBL::Analysis $value
...
...
scripts/local_beekeeper.pl
View file @
68bf9ff4
...
...
@@ -7,6 +7,7 @@ use Bio::EnsEMBL::Compara::DBSQL::DBAdaptor;
use
Bio::EnsEMBL::Hive::
Worker
;
use
Bio::EnsEMBL::Hive::
Queen
;
use
Bio::EnsEMBL::Hive::
URLFactory
;
use
Sys::
Hostname
;
# ok this is a hack, but I'm going to pretend I've got an object here
# by creating a blessed hash ref and passing it around like an object
...
...
@@ -44,6 +45,7 @@ my $DBA;
if
(
$url
)
{
$DBA
=
Bio::EnsEMBL::Hive::
URLFactory
->
fetch
(
$url
);
die
("
Unable to connect to
$url
\n
")
unless
(
$DBA
);
}
else
{
if
(
$host
)
{
$self
->
{'
db_conf
'}
->
{'
-host
'}
=
$host
;
}
if
(
$port
)
{
$self
->
{'
db_conf
'}
->
{'
-port
'}
=
$port
;
}
...
...
@@ -63,9 +65,11 @@ if($url) {
# connect to database specified
$DBA
=
new
Bio::EnsEMBL::Compara::DBSQL::
DBAdaptor
(
%
{
$self
->
{'
db_conf
'}});
}
print
("
$DBA
\n
");
$self
->
{'
queen
'}
=
new
Bio::EnsEMBL::Hive::
Queen
(
$DBA
);
check_for_dead_workers
(
$self
,
$self
->
{'
queen
'});
run_beekeeper
(
$self
);
Bio::EnsEMBL::Hive::
URLFactory
->
cleanup
;
...
...
@@ -120,12 +124,6 @@ sub run_beekeeper
my
$self
=
shift
;
my
$queen
=
$self
->
{'
queen
'};
my
$overdueWorkers
=
$queen
->
fetch_overdue_workers
(
3600
);
#overdue by 1hr
print
(
scalar
(
@
{
$overdueWorkers
}),
"
overdue workers
\n
");
foreach
my
$worker
(
@
{
$overdueWorkers
})
{
printf
("
%10d %20s analysis_id=%d
\n
",
$worker
->
hive_id
,
$worker
->
host
,
$worker
->
analysis
->
dbID
);
$queen
->
register_worker_death
(
$worker
);
}
$queen
->
update_analysis_stats
();
my
(
$analysis_id
,
$count
)
=
$queen
->
next_clutch
();
...
...
@@ -137,4 +135,26 @@ sub run_beekeeper
}
sub
check_for_dead_workers
{
my
$self
=
shift
;
my
$queen
=
shift
;
my
$host
=
hostname
;
my
$overdueWorkers
=
$queen
->
fetch_overdue_workers
(
3600
);
#overdue by 1hr
print
(
scalar
(
@
{
$overdueWorkers
}),
"
overdue workers
\n
");
foreach
my
$worker
(
@
{
$overdueWorkers
})
{
if
((
$worker
->
beekeeper
eq
'
local
')
and
(
$worker
->
host
eq
$host
))
{
my
$cmd
=
"
ps -p
"
.
$worker
->
process_id
;
my
$check
=
qx/$cmd/
;
print
("
check :
$check
\n
");
printf
("
%10d %20s analysis_id=%d
\n
",
$worker
->
hive_id
,
$worker
->
host
,
$worker
->
analysis
->
dbID
);
#$queen->register_worker_death($worker);
}
}
}
sql/tables.sql
View file @
68bf9ff4
...
...
@@ -14,6 +14,7 @@
CREATE
TABLE
hive
(
hive_id
int
(
10
)
NOT
NULL
auto_increment
,
analysis_id
int
(
10
)
NOT
NULL
,
beekeeper
varchar
(
80
)
DEAFULT
''
NOT
NULL
,
host
varchar
(
40
)
DEFAULT
''
NOT
NULL
,
process_id
int
(
10
)
NOT
NULL
,
work_done
int
(
11
)
DEFAULT
'0'
NOT
NULL
,
...
...
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