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
229783f5
Commit
229783f5
authored
May 18, 2012
by
Leo Gordon
Browse files
added schema and API support for meadow_name
parent
8b2f8d26
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
46 additions
and
18 deletions
+46
-18
modules/Bio/EnsEMBL/Hive/Meadow.pm
modules/Bio/EnsEMBL/Hive/Meadow.pm
+1
-1
modules/Bio/EnsEMBL/Hive/Meadow/LOCAL.pm
modules/Bio/EnsEMBL/Hive/Meadow/LOCAL.pm
+10
-5
modules/Bio/EnsEMBL/Hive/Meadow/LSF.pm
modules/Bio/EnsEMBL/Hive/Meadow/LSF.pm
+9
-0
modules/Bio/EnsEMBL/Hive/Queen.pm
modules/Bio/EnsEMBL/Hive/Queen.pm
+7
-5
modules/Bio/EnsEMBL/Hive/Valley.pm
modules/Bio/EnsEMBL/Hive/Valley.pm
+6
-5
modules/Bio/EnsEMBL/Hive/Worker.pm
modules/Bio/EnsEMBL/Hive/Worker.pm
+5
-0
scripts/runWorker.pl
scripts/runWorker.pl
+3
-2
sql/patch_2012-05-18.sql
sql/patch_2012-05-18.sql
+3
-0
sql/tables.sql
sql/tables.sql
+1
-0
sql/tables.sqlite
sql/tables.sqlite
+1
-0
No files found.
modules/Bio/EnsEMBL/Hive/Meadow.pm
View file @
229783f5
...
...
@@ -59,7 +59,7 @@ sub generate_job_name {
sub
responsible_for_worker
{
my
(
$self
,
$worker
)
=
@_
;
return
$worker
->
meadow_type
()
eq
$self
->
type
(
);
return
(
$worker
->
meadow_type
eq
$self
->
type
)
&&
(
$worker
->
meadow_name
eq
$self
->
name
);
}
sub
check_worker_is_alive_and_mine
{
...
...
modules/Bio/EnsEMBL/Hive/Meadow/LOCAL.pm
View file @
229783f5
...
...
@@ -14,6 +14,12 @@ sub available { # always invoked as a class method
}
sub
name
{
return
hostname
();
}
sub
total_running_workers_default_max
{
return
2
;
...
...
@@ -26,6 +32,7 @@ sub get_current_worker_process_id {
return
$$
;
}
sub
count_running_workers
{
my
$self
=
shift
@_
;
...
...
@@ -36,11 +43,6 @@ sub count_running_workers {
return
$run_count
;
}
sub
responsible_for_worker
{
my
(
$self
,
$worker
)
=
@_
;
return
(
$self
->
SUPER::
responsible_for_worker
(
$worker
)
&&
(
$worker
->
host
eq
hostname
())
);
}
sub
status_of_all_our_workers
{
# returns a hashref
my
(
$self
)
=
@_
;
...
...
@@ -76,6 +78,7 @@ sub status_of_all_our_workers { # returns a hashref
return
\
%status_hash
;
}
sub
check_worker_is_alive_and_mine
{
my
(
$self
,
$worker
)
=
@_
;
...
...
@@ -86,6 +89,7 @@ sub check_worker_is_alive_and_mine {
return
$is_alive_and_mine
;
}
sub
kill_worker
{
my
(
$self
,
$worker
)
=
@_
;
...
...
@@ -101,6 +105,7 @@ sub kill_worker {
}
}
sub
submit_workers
{
my
(
$self
,
$iteration
,
$worker_cmd
,
$worker_count
,
$rc_id
,
$rc_parameters
)
=
@_
;
...
...
modules/Bio/EnsEMBL/Hive/Meadow/LSF.pm
View file @
229783f5
...
...
@@ -12,6 +12,15 @@ sub available { # always invoked as a class method
return
`
which bjobs 2>/dev/null
`;
}
sub
name
{
my
$mcni
=
'
My cluster name is
';
if
(
my
$name
=
`
lsid | grep '
$mcni
'
`)
{
$name
=~
/^$mcni\s+(\w+)/
;
return
$
1
;
}
}
sub
get_current_worker_process_id
{
my
(
$self
)
=
@_
;
...
...
modules/Bio/EnsEMBL/Hive/Queen.pm
View file @
229783f5
...
...
@@ -97,11 +97,11 @@ use base ('Bio::EnsEMBL::DBSQL::BaseAdaptor');
sub
create_new_worker
{
my
(
$self
,
@args
)
=
@_
;
my
(
$meadow_type
,
$process_id
,
$exec_host
,
my
(
$meadow_type
,
$meadow_name
,
$process_id
,
$exec_host
,
$rc_id
,
$logic_name
,
$analysis_id
,
$input_id
,
$job_id
,
$no_write
,
$debug
,
$worker_output_dir
,
$hive_output_dir
,
$job_limit
,
$life_span
,
$no_cleanup
,
$retry_throwing_jobs
)
=
rearrange
([
qw(meadow_type process_id exec_host
rearrange
([
qw(meadow_type
meadow_name
process_id exec_host
rc_id logic_name analysis_id input_id job_id
no_write debug worker_output_dir hive_output_dir job_limit life_span no_cleanup retry_throwing_jobs)
],
@args
);
...
...
@@ -198,11 +198,11 @@ sub create_new_worker {
}
my
$sql
=
q{INSERT INTO worker
(born, last_check_in, meadow_type, process_id, host, analysis_id)
VALUES (CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, ?,?,?,?)}
;
(born, last_check_in, meadow_type,
meadow_name,
process_id, host, analysis_id)
VALUES (CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, ?,?,?,?
,?
)}
;
my
$sth
=
$self
->
prepare
(
$sql
);
$sth
->
execute
(
$meadow_type
,
$process_id
,
$exec_host
,
$analysisStats
->
analysis_id
);
$sth
->
execute
(
$meadow_type
,
$meadow_name
,
$process_id
,
$exec_host
,
$analysisStats
->
analysis_id
);
my
$worker_id
=
$self
->
dbc
->
db_handle
->
last_insert_id
(
undef
,
undef
,
'
worker
',
'
worker_id
');
$sth
->
finish
;
...
...
@@ -1016,6 +1016,7 @@ sub _columns {
return
qw (w.worker_id
w
.
analysis_id
w
.
meadow_type
w
.
meadow_name
w
.
host
w
.
process_id
w
.
work_done
...
...
@@ -1041,6 +1042,7 @@ sub _objs_from_sth {
$worker
->
dbID
(
$column
{'
worker_id
'});
$worker
->
meadow_type
(
$column
{'
meadow_type
'});
$worker
->
meadow_name
(
$column
{'
meadow_name
'});
$worker
->
host
(
$column
{'
host
'});
$worker
->
process_id
(
$column
{'
process_id
'});
$worker
->
work_done
(
$column
{'
work_done
'});
...
...
modules/Bio/EnsEMBL/Hive/Valley.pm
View file @
229783f5
...
...
@@ -97,14 +97,15 @@ sub current_meadow_class {
}
sub
guess_current_type_pid_exechost
{
sub
whereami
{
my
$self
=
shift
@_
;
my
(
$
typ
e
,
$pid
);
my
(
$
meadow_type
,
$meadow_nam
e
,
$pid
);
foreach
my
$meadow_class
(
@
{
$self
->
get_available_meadow_classes_list
})
{
eval
{
$pid
=
$meadow_class
->
get_current_worker_process_id
();
$type
=
$meadow_class
->
type
();
$pid
=
$meadow_class
->
get_current_worker_process_id
();
$meadow_type
=
$meadow_class
->
type
();
$meadow_name
=
$meadow_class
->
name
();
};
unless
(
$@
)
{
last
;
...
...
@@ -116,7 +117,7 @@ sub guess_current_type_pid_exechost {
my
$exechost
=
hostname
();
return
(
$
typ
e
,
$pid
,
$exechost
);
return
(
$
meadow_type
,
$meadow_nam
e
,
$pid
,
$exechost
);
}
...
...
modules/Bio/EnsEMBL/Hive/Worker.pm
View file @
229783f5
...
...
@@ -114,6 +114,11 @@ sub meadow_type {
$self
->
{'
_meadow_type
'}
=
shift
if
(
@
_
);
return
$self
->
{'
_meadow_type
'};
}
sub
meadow_name
{
my
$self
=
shift
;
$self
->
{'
_meadow_name
'}
=
shift
if
(
@
_
);
return
$self
->
{'
_meadow_name
'};
}
sub
debug
{
my
$self
=
shift
;
$self
->
{'
_debug
'}
=
shift
if
(
@
_
);
...
...
scripts/runWorker.pl
View file @
229783f5
...
...
@@ -89,9 +89,9 @@ unless($DBA and $DBA->isa("Bio::EnsEMBL::Hive::DBSQL::DBAdaptor")) {
my
$queen
=
$DBA
->
get_Queen
();
my
(
$meadow_type
,
$process_id
,
$exec_host
)
=
Bio::EnsEMBL::Hive::
Valley
->
new
()
->
guess_current_type_pid_exechost
();
my
(
$meadow_type
,
$meadow_name
,
$process_id
,
$exec_host
)
=
Bio::EnsEMBL::Hive::
Valley
->
new
()
->
whereami
();
print
"
runWorker(-MeadowType =>
$meadow_type
, -ProcessId =>
$process_id
, -ExecHost =>
$exec_host
)
\n
";
print
"
runWorker(-MeadowType =>
$meadow_type
,
-MeadowName =>
$meadow_name
,
-ProcessId =>
$process_id
, -ExecHost =>
$exec_host
)
\n
";
my
$worker
;
...
...
@@ -99,6 +99,7 @@ eval {
$worker
=
$queen
->
create_new_worker
(
# Worker identity:
-
meadow_type
=>
$meadow_type
,
-
meadow_name
=>
$meadow_name
,
-
process_id
=>
$process_id
,
-
exec_host
=>
$exec_host
,
...
...
sql/patch_2012-05-18.sql
0 → 100644
View file @
229783f5
-- add a way to distinguish between meadows of the same type:
ALTER
TABLE
worker
ADD
COLUMN
meadow_name
VARCHAR
(
40
)
AFTER
meadow_type
;
sql/tables.sql
View file @
229783f5
...
...
@@ -108,6 +108,7 @@ CREATE TABLE worker (
worker_id
int
(
10
)
unsigned
NOT
NULL
AUTO_INCREMENT
,
analysis_id
int
(
10
)
unsigned
NOT
NULL
,
meadow_type
enum
(
'LSF'
,
'LOCAL'
)
NOT
NULL
,
meadow_name
varchar
(
40
)
DEFAULT
NULL
,
host
varchar
(
40
)
DEFAULT
NULL
,
process_id
varchar
(
40
)
DEFAULT
NULL
,
work_done
int
(
11
)
DEFAULT
'0'
NOT
NULL
,
...
...
sql/tables.sqlite
View file @
229783f5
...
...
@@ -98,6 +98,7 @@ CREATE TABLE worker (
worker_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
analysis_id INTEGER NOT NULL,
meadow_type TEXT NOT NULL, /* enum('LSF', 'LOCAL') NOT NULL, */
meadow_name varchar(40) DEFAULT NULL,
host varchar(40) DEFAULT NULL,
process_id varchar(40) DEFAULT 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