Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ensembl-hive
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
7
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ensembl-gh-mirror
ensembl-hive
Commits
6d6edeb3
Commit
6d6edeb3
authored
10 years ago
by
Leo Gordon
Browse files
Options
Downloads
Patches
Plain Diff
use higher level API instead of direct SQL to create a new Worker
parent
90513b84
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/Bio/EnsEMBL/Hive/Queen.pm
+17
-14
17 additions, 14 deletions
modules/Bio/EnsEMBL/Hive/Queen.pm
with
17 additions
and
14 deletions
modules/Bio/EnsEMBL/Hive/Queen.pm
+
17
−
14
View file @
6d6edeb3
...
...
@@ -131,23 +131,27 @@ sub create_new_worker {
$self
->
register_worker_death
(
$prev_worker_incarnation
);
}
my
$resource_class
;
if
(
defined
(
$resource_class_name
)
)
{
my
$rc
=
$self
->
db
->
get_ResourceClassAdaptor
->
fetch_by_name
(
$resource_class_name
)
$resource_class
=
$self
->
db
->
get_ResourceClassAdaptor
->
fetch_by_name
(
$resource_class_name
)
or
die
"
resource_class with name='
$resource_class_name
' could not be fetched from the database
";
$resource_class_id
=
$rc
->
dbID
;
}
elsif
(
defined
(
$resource_class_id
)
)
{
$resource_class
=
$self
->
db
->
get_ResourceClassAdaptor
->
fetch_by_dbID
(
$resource_class_id
)
or
die
"
resource_class with dbID='
$resource_class_id
' could not be fetched from the database
";
}
my
$sql
=
q{INSERT INTO worker (born, last_check_in, meadow_type, meadow_name, host, process_id, resource_class_id)
VALUES (CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, ?, ?, ?, ?, ?)}
;
my
$sth
=
$self
->
prepare
(
$sql
);
$sth
->
execute
(
$meadow_type
,
$meadow_name
,
$exec_host
,
$process_id
,
$resource_class_id
);
my
$worker_id
=
$self
->
dbc
->
db_handle
->
last_insert_id
(
undef
,
undef
,
'
worker
',
'
worker_id
')
or
die
"
Could not insert a new worker
";
$sth
->
finish
;
my
$worker
=
Bio::EnsEMBL::Hive::
Worker
->
new
(
'
meadow_type
'
=>
$meadow_type
,
'
meadow_name
'
=>
$meadow_name
,
'
host
'
=>
$exec_host
,
'
process_id
'
=>
$process_id
,
'
resource_class
'
=>
$resource_class
,
);
$self
->
store
(
$worker
);
my
$worker_id
=
$worker
->
dbID
;
my
$worker
=
$self
->
fetch_by_dbID
(
$worker_id
)
$worker
=
$self
->
fetch_by_dbID
(
$worker_id
)
# refresh the object to get the fields initialized at SQL level (timestamps in this case
)
or
die
"
Could not fetch worker with dbID=
$worker_id
";
if
(
$hive_log_dir
or
$worker_log_dir
)
{
...
...
@@ -727,8 +731,7 @@ sub interval_workers_with_unknown_usage {
my
$sql_times
=
qq{
SELECT meadow_type, meadow_name, min(born), max(died), count(*)
FROM worker w
LEFT JOIN worker_resource_usage u
USING(worker_id)
LEFT JOIN worker_resource_usage u USING(worker_id)
WHERE u.worker_id IS NULL
GROUP BY meadow_type, meadow_name
}
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment