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
36053303
Commit
36053303
authored
Oct 15, 2012
by
Leo Gordon
Browse files
pass either rc_name or logic_name or job_id from beekeeper.pl to runWorker.pl
parent
26e3e57a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
28 deletions
+31
-28
scripts/beekeeper.pl
scripts/beekeeper.pl
+31
-28
No files found.
scripts/beekeeper.pl
View file @
36053303
...
...
@@ -192,32 +192,32 @@ sub main {
$job
->
print_job
();
}
if
(
my
$logic_name
_to_reset
=
$reset_all_jobs_for_analysis
||
$reset_failed_jobs_for_analysis
)
{
if
(
my
$
reset_
logic_name
=
$reset_all_jobs_for_analysis
||
$reset_failed_jobs_for_analysis
)
{
my
$analysis
=
$self
->
{'
dba
'}
->
get_AnalysisAdaptor
->
fetch_by_logic_name
(
$logic_name
_to_reset
)
||
die
(
"
Cannot AnalysisAdaptor->fetch_by_logic_name(
$logic_name
_to_reset
)
");
my
$
reset_
analysis
=
$self
->
{'
dba
'}
->
get_AnalysisAdaptor
->
fetch_by_logic_name
(
$
reset_
logic_name
)
||
die
(
"
Cannot AnalysisAdaptor->fetch_by_logic_name(
$
reset_
logic_name
)
");
$self
->
{'
dba
'}
->
get_AnalysisJobAdaptor
->
reset_jobs_for_analysis_id
(
$analysis
->
dbID
,
$reset_all_jobs_for_analysis
);
$self
->
{'
dba
'}
->
get_Queen
->
synchronize_AnalysisStats
(
$analysis
->
stats
);
$self
->
{'
dba
'}
->
get_AnalysisJobAdaptor
->
reset_jobs_for_analysis_id
(
$
reset_
analysis
->
dbID
,
$reset_all_jobs_for_analysis
);
$self
->
{'
dba
'}
->
get_Queen
->
synchronize_AnalysisStats
(
$
reset_
analysis
->
stats
);
}
if
(
$all_dead
)
{
$queen
->
register_all_workers_dead
();
}
if
(
$check_for_dead
)
{
$queen
->
check_for_dead_workers
(
$valley
,
1
);
}
if
(
$kill_worker_id
)
{
my
$worker
=
$queen
->
fetch_by_dbID
(
$kill_worker_id
);
my
$
kill_
worker
=
$queen
->
fetch_by_dbID
(
$kill_worker_id
);
unless
(
$worker
->
cause_of_death
()
)
{
if
(
my
$meadow
=
$valley
->
find_available_meadow_responsible_for_worker
(
$worker
)
)
{
unless
(
$
kill_
worker
->
cause_of_death
()
)
{
if
(
my
$meadow
=
$valley
->
find_available_meadow_responsible_for_worker
(
$
kill_
worker
)
)
{
if
(
$meadow
->
check_worker_is_alive_and_mine
)
{
printf
("
Killing worker: %10d %35s %15s %20s(%d) :
",
$worker
->
dbID
,
$worker
->
host
,
$worker
->
process_id
,
$worker
->
analysis
->
logic_name
,
$worker
->
analysis
->
dbID
);
$
kill_
worker
->
dbID
,
$
kill_
worker
->
host
,
$
kill_
worker
->
process_id
,
$
kill_
worker
->
analysis
->
logic_name
,
$
kill_
worker
->
analysis
->
dbID
);
$meadow
->
kill_worker
(
$worker
);
$worker
->
cause_of_death
('
KILLED_BY_USER
');
$queen
->
register_worker_death
(
$worker
);
$meadow
->
kill_worker
(
$
kill_
worker
);
$
kill_
worker
->
cause_of_death
('
KILLED_BY_USER
');
$queen
->
register_worker_death
(
$
kill_
worker
);
# what about clean-up? Should we do it here or not?
}
else
{
die
"
According to the Meadow, the Worker (dbID=
$kill_worker_id
) is not running, so cannot kill
";
...
...
@@ -280,7 +280,7 @@ sub main {
sub
generate_worker_cmd
{
my
(
$self
,
$run_job_id
)
=
@_
;
my
(
$self
,
$run_analysis
,
$run_job_id
)
=
@_
;
my
$worker_cmd
=
'
runWorker.pl
';
...
...
@@ -294,30 +294,33 @@ sub generate_worker_cmd {
$worker_cmd
.=
'
-url
'
.
$self
->
{'
url
'};
}
if
(
$run_job_id
)
{
$worker_cmd
.=
"
-job_id
$run_job_id
";
}
else
{
foreach
my
$worker_option
('
job_limit
',
'
life_span
',
'
logic_name
',
'
retry_throwing_jobs
',
'
compile_module_once
',
'
hive_log_dir
',
'
debug
')
{
if
(
defined
(
my
$value
=
$self
->
{
$worker_option
}))
{
$worker_cmd
.=
"
-
${worker_option}
$value
";
}
foreach
my
$worker_option
('
job_limit
',
'
life_span
',
'
retry_throwing_jobs
',
'
compile_module_once
',
'
hive_log_dir
',
'
debug
')
{
if
(
defined
(
my
$value
=
$self
->
{
$worker_option
}))
{
$worker_cmd
.=
"
-
${worker_option}
$value
";
}
}
# special task:
if
(
$run_analysis
)
{
$worker_cmd
.=
"
-logic_name
"
.
$run_analysis
->
logic_name
;
}
elsif
(
$run_job_id
)
{
$worker_cmd
.=
"
-job_id
$run_job_id
";
}
return
$worker_cmd
;
}
sub
run_autonomously
{
my
(
$self
,
$max_loops
,
$keep_alive
,
$queen
,
$valley
,
$
this
_analysis
,
$run_job_id
)
=
@_
;
my
(
$self
,
$max_loops
,
$keep_alive
,
$queen
,
$valley
,
$
run
_analysis
,
$run_job_id
)
=
@_
;
unless
(`
runWorker.pl
`)
{
print
("
can't find runWorker.pl script. Please make sure it's in your path
\n
");
exit
(
1
);
}
my
$current_meadow
=
$valley
->
get_current_meadow
();
my
$worker_cmd
=
generate_worker_cmd
(
$self
,
$run_job_id
);
my
$current_meadow
=
$valley
->
get_current_meadow
();
my
$worker_cmd
=
generate_worker_cmd
(
$self
,
$run_analysis
,
$run_job_id
);
my
$special_task
=
$run_analysis
||
$run_job_id
;
# first, fetch two resource-related mappings from the database:
my
$rc_name2id
=
$self
->
{'
dba
'}
->
get_ResourceClassAdaptor
->
fetch_HASHED_FROM_name_TO_resource_class_id
();
...
...
@@ -345,7 +348,7 @@ sub run_autonomously {
$queen
->
print_analysis_status
unless
(
$self
->
{'
no_analysis_stats
'});
$queen
->
print_running_worker_counts
;
my
$workers_to_run_by_rc_name
=
$queen
->
schedule_workers_resync_if_necessary
(
$valley
,
$
this
_analysis
);
my
$workers_to_run_by_rc_name
=
$queen
->
schedule_workers_resync_if_necessary
(
$valley
,
$
run
_analysis
);
if
(
keys
%$workers_to_run_by_rc_name
)
{
foreach
my
$rc_name
(
sort
{
$workers_to_run_by_rc_name
->
{
$a
}
<=>
$workers_to_run_by_rc_name
->
{
$b
}
}
keys
%$workers_to_run_by_rc_name
)
{
...
...
@@ -353,13 +356,13 @@ sub run_autonomously {
print
"
Submitting
$this_rc_worker_count
workers (rc_name=
$rc_name
) to
"
.
$current_meadow
->
toString
()
.
"
\n
";
$current_meadow
->
submit_workers
(
"
$worker_cmd
-rc_name
$rc_name
",
$this_rc_worker_count
,
$iteration
,
$rc_name
,
$rc_name2xparams
{
$rc_name
}
||
'');
$current_meadow
->
submit_workers
(
$worker_cmd
.
(
$special_task
?
''
:
"
-rc_name
$rc_name
"
)
,
$this_rc_worker_count
,
$iteration
,
$rc_name
,
$rc_name2xparams
{
$rc_name
}
||
'');
}
}
else
{
print
"
Not submitting any workers this iteration
\n
";
}
$failed_analyses
=
$queen
->
get_num_failed_analyses
(
$
this
_analysis
);
$failed_analyses
=
$queen
->
get_num_failed_analyses
(
$
run
_analysis
);
$num_of_remaining_jobs
=
$queen
->
get_remaining_jobs_show_hive_progress
();
}
while
(
$keep_alive
...
...
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