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
f486d5ba
Commit
f486d5ba
authored
Aug 24, 2010
by
Leo Gordon
Browse files
an attempt to allow multiple users' beekeepers to keep one hive (needs more testing)
parent
0760257c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
29 deletions
+31
-29
modules/Bio/EnsEMBL/Hive/Meadow.pm
modules/Bio/EnsEMBL/Hive/Meadow.pm
+9
-3
modules/Bio/EnsEMBL/Hive/Meadow/LOCAL.pm
modules/Bio/EnsEMBL/Hive/Meadow/LOCAL.pm
+8
-6
modules/Bio/EnsEMBL/Hive/Meadow/LSF.pm
modules/Bio/EnsEMBL/Hive/Meadow/LSF.pm
+13
-19
modules/Bio/EnsEMBL/Hive/Queen.pm
modules/Bio/EnsEMBL/Hive/Queen.pm
+1
-1
No files found.
modules/Bio/EnsEMBL/Hive/Meadow.pm
View file @
f486d5ba
...
...
@@ -34,12 +34,18 @@ sub meadow_options { # general options that different Meadows can plug into t
return
$self
->
{'
_meadow_options
'}
||
'';
}
sub
job_name_prefix
{
my
$self
=
shift
@_
;
return
(
$self
->
pipeline_name
()
?
$self
->
pipeline_name
()
.
'
-
'
:
'')
.
'
Hive
';
}
sub
generate_job_name
{
my
(
$self
,
$worker_count
,
$iteration
,
$rc_id
)
=
@_
;
$rc_id
||=
0
;
return
(
$self
->
pipeline_name
()
?
$self
->
pipeline_name
()
.
'
-
'
:
''
)
.
"
Hive
${rc_id}
_
${iteration}
"
return
$self
->
job_name_prefix
(
)
.
"
${rc_id}
_
${iteration}
"
.
((
$worker_count
>
1
)
?
"
[1-
${worker_count}
]
"
:
'');
}
...
...
@@ -49,7 +55,7 @@ sub responsible_for_worker {
return
$worker
->
beekeeper
()
eq
$self
->
type
();
}
sub
check_worker_is_alive
{
sub
check_worker_is_alive
_and_mine
{
my
(
$self
,
$worker
)
=
@_
;
die
"
Please use a derived method
";
...
...
modules/Bio/EnsEMBL/Hive/Meadow/LOCAL.pm
View file @
f486d5ba
...
...
@@ -29,7 +29,7 @@ sub responsible_for_worker {
return
(
$self
->
SUPER::
responsible_for_worker
(
$worker
)
&&
(
$worker
->
host
eq
hostname
())
);
}
sub
status_of_all_
my
_workers
{
# returns a hashref
sub
status_of_all_
our
_workers
{
# returns a hashref
my
(
$self
)
=
@_
;
my
$cmd
=
'
ps x -o state,pid,command -w -w | grep runWorker.pl | grep -v "grep runWorker.pl"
';
...
...
@@ -53,19 +53,21 @@ sub status_of_all_my_workers { # returns a hashref
return
\
%status_hash
;
}
sub
check_worker_is_alive
{
sub
check_worker_is_alive
_and_mine
{
my
(
$self
,
$worker
)
=
@_
;
my
$cmd
=
'
ps
'
.
$worker
->
process_id
.
'
2>&1 | grep
'
.
$worker
->
process_id
;
my
$is_alive
=
qx/$cmd/
;
return
$is_alive
;
my
$wpid
=
$worker
->
process_id
();
my
$cmd
=
qq{ps x | grep $wpid | grep -v 'grep $wpid'}
;
my
$is_alive_and_mine
=
qx/$cmd/
;
return
$is_alive_and_mine
;
}
sub
kill_worker
{
my
(
$self
,
$worker
)
=
@_
;
if
(
$self
->
responsible_for_worker
(
$worker
)
)
{
if
(
$self
->
check_worker_is_alive
(
$worker
))
{
if
(
$self
->
check_worker_is_alive
_and_mine
(
$worker
))
{
my
$cmd
=
'
kill -9
'
.
$worker
->
process_id
();
system
(
$cmd
);
}
else
{
...
...
modules/Bio/EnsEMBL/Hive/Meadow/LSF.pm
View file @
f486d5ba
...
...
@@ -26,13 +26,8 @@ sub get_current_worker_process_id {
sub
count_pending_workers
{
my
(
$self
)
=
@_
;
my
$cmd
=
"
bjobs -w
";
if
(
my
$pipeline_name
=
$self
->
pipeline_name
())
{
$cmd
.=
"
| grep '
${pipeline_name}
-Hive'
";
}
else
{
$cmd
.=
"
| grep Hive
";
}
$cmd
.=
"
| grep -c PEND
";
my
$jnp
=
$self
->
job_name_prefix
();
my
$cmd
=
qq{bjobs -w -J '${jnp}*' -u all | grep -c PEND}
;
my
$pend_count
=
qx/$cmd/
;
chomp
(
$pend_count
);
...
...
@@ -40,15 +35,11 @@ sub count_pending_workers {
return
$pend_count
;
}
sub
status_of_all_
my
_workers
{
# returns a hashref
sub
status_of_all_
our
_workers
{
# returns a hashref
my
(
$self
)
=
@_
;
my
$cmd
=
'
bjobs -w 2>&1 | grep -v "No unfinished job found" | grep -v JOBID | grep -v DONE | grep -v EXIT
';
if
(
my
$pipeline_name
=
$self
->
pipeline_name
())
{
$cmd
.=
"
| grep '
${pipeline_name}
-Hive'
";
}
else
{
$cmd
.=
"
| grep Hive
";
}
my
$jnp
=
$self
->
job_name_prefix
();
my
$cmd
=
qq{bjobs -w -J '${jnp}*' -u all 2>&1 | grep -v 'No unfinished job found' | grep -v JOBID | grep -v DONE | grep -v EXIT}
;
my
%status_hash
=
();
foreach
my
$line
(`
$cmd
`)
{
...
...
@@ -64,18 +55,21 @@ sub status_of_all_my_workers { # returns a hashref
return
\
%status_hash
;
}
sub
check_worker_is_alive
{
sub
check_worker_is_alive
_and_mine
{
my
(
$self
,
$worker
)
=
@_
;
my
$cmd
=
'
bjobs
'
.
$worker
->
process_id
.
'
2>&1 | grep -v "not found" | grep -v JOBID | grep -v EXIT
';
my
$is_alive
=
qx/$cmd/
;
return
$is_alive
;
my
$wpid
=
$worker
->
process_id
();
my
$this_user
=
$ENV
{'
USER
'};
my
$cmd
=
qq{bjobs $wpid -u $this_user 2>&1 | grep -v 'not found' | grep -v JOBID | grep -v EXIT}
;
my
$is_alive_and_mine
=
qx/$cmd/
;
return
$is_alive_and_mine
;
}
sub
kill_worker
{
my
(
$self
,
$worker
)
=
@_
;
if
(
$self
->
check_worker_is_alive
(
$worker
))
{
if
(
$self
->
check_worker_is_alive
_and_mine
(
$worker
))
{
my
$cmd
=
'
bkill
'
.
$worker
->
process_id
();
system
(
$cmd
);
}
else
{
...
...
modules/Bio/EnsEMBL/Hive/Queen.pm
View file @
f486d5ba
...
...
@@ -201,7 +201,7 @@ sub register_worker_death {
sub
check_for_dead_workers
{
my
(
$self
,
$meadow
,
$check_buried_in_haste
)
=
@_
;
my
$worker_status_hash
=
$meadow
->
status_of_all_
my
_workers
();
my
$worker_status_hash
=
$meadow
->
status_of_all_
our
_workers
();
my
%worker_status_summary
=
();
my
$queen_worker_list
=
$self
->
fetch_overdue_workers
(
0
);
...
...
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