Skip to content

Commit 39c6bb6

Browse files
Merge pull request wtsi-npg#877 from mgcam/daemon_pickup_illumina_only
Restricted pipeline daemons to deal with runs by a certain manufacturer.
2 parents fec9f6b + fb42b41 commit 39c6bb6

File tree

10 files changed

+115
-24
lines changed

10 files changed

+115
-24
lines changed

Changes

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
LIST OF CHANGES
22
---------------
33

4+
- Changed pipeline daemons so that they pick up runs performed on the
5+
instruments by a manufacturer with a name given by a new attribute -
6+
instrument_name. By default this name is set to 'Illumina' so that
7+
the daemons continue picking up Illumina-only runs even if other
8+
runs are present in the run tracking database.
9+
- Deleted redundant t::dbic_util::test_schema_wh method.
10+
411
release 68.7.1 (2024-12-17)
512
- Fix perlbrew installation by installing libdevel-patchperl-perl in runner
613
- Changed/extended tests for npg_pipeline::function::autoqc to ensure that

MANIFEST

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ t/data/cache/my_samplesheet_12376.csv
139139
t/data/dbic_fixtures/000-Designation.yml
140140
t/data/dbic_fixtures/000-EntityType.yml
141141
t/data/dbic_fixtures/000-InstrumentStatusDict.yml
142+
t/data/dbic_fixtures/000-Manufacturer.yml
142143
t/data/dbic_fixtures/000-RunLaneStatusDict.yml
143144
t/data/dbic_fixtures/000-RunStatusDict.yml
144145
t/data/dbic_fixtures/000-Tag.yml

lib/npg_pipeline/daemon.pm

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ with qw{
2121
our $VERSION = '0';
2222

2323
Readonly::Scalar my $SLEEPY_TIME => 900;
24+
Readonly::Scalar my $DEFAULT_INSTRUMENT_MANUFACTURER => 'Illumina';
2425

2526
has 'pipeline_script_name' => (
2627
isa => q{Str},
@@ -30,12 +31,21 @@ has 'pipeline_script_name' => (
3031
builder => 'build_pipeline_script_name',
3132
);
3233

34+
has 'manufacturer_name' => (
35+
isa => q{Str},
36+
is => q{ro},
37+
default => $DEFAULT_INSTRUMENT_MANUFACTURER,
38+
documentation => 'Instrument manufacturer name, defaults to Illumina. ' .
39+
'Runs on instruments by this manufacturer only will be ' .
40+
'considered by this daemon.',
41+
);
42+
3343
has 'dry_run' => (
3444
isa => q{Bool},
3545
is => q{ro},
3646
required => 0,
3747
default => 0,
38-
documentation => 'dry run mode flag, false by default',
48+
documentation => 'Dry run mode flag, false by default',
3949
);
4050

4151
has 'seen' => (
@@ -58,6 +68,7 @@ sub _build_npg_tracking_schema {
5868

5969
sub runs_with_status {
6070
my ($self, $status_name, $from_time) = @_;
71+
6172
if (!$status_name) {
6273
$self->logcroak(q[Need status name]);
6374
}
@@ -73,7 +84,8 @@ sub runs_with_status {
7384
}
7485

7586
return
76-
map { $_->run() }
87+
grep { $_->instrument_format->manufacturer->name eq $self->manufacturer_name }
88+
map { $_->run() }
7789
$self->npg_tracking_schema()->resultset(q[RunStatus])->search(
7890
$condition,
7991
{prefetch=>q[run_status_dict], order_by => q[me.date],}
@@ -194,8 +206,8 @@ case of error.
194206
=head2 runs_with_status
195207
196208
With one argument, which should be a valid run status description,
197-
returns a list of DBIx::Class::Row objects from the Run result set,
198-
which correspond to runs with the current status descriptiongiven
209+
returns a list of C<DBIx::Class::Row> objects from the C<Run> result set,
210+
which correspond to runs with the current status description given
199211
by the argument.
200212
201213
# find runs with current status 'archival pending'
@@ -215,6 +227,9 @@ should be after the time given by the second argument.
215227
In both cases a list of returned objects is sorted in the assending
216228
run status timestamp order.
217229
230+
Only runs performed on the instruments by the manufacturer given by
231+
the C<manufacturer_name> attribute are chosen.
232+
218233
If no run satisfies the conditions given by the argument(s), an
219234
empty list is returned.
220235

t/50-npg_pipeline-daemon-analysis.t

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use strict;
22
use warnings;
3-
use Test::More tests => 12;
3+
use Test::More tests => 8;
44
use Test::Exception;
55
use Cwd qw{ getcwd abs_path };
66
use File::Path qw{ make_path };
@@ -30,19 +30,38 @@ my $schema = t::dbic_util->new()->test_schema();
3030
my $test_run = $schema->resultset(q[Run])->find(1234);
3131
$test_run->update_run_status('analysis pending', 'pipeline',);
3232

33-
my %h = map { $_ => 1 } (1234, 4330, 4999, 5222);
34-
my @statuses = ();
35-
for my $r ($schema->resultset(q[Run])->search({})->all()) {
36-
my $id = $r->id_run;
37-
if ($h{$id}) {
38-
cmp_ok ($r->current_run_status_description, 'eq',
39-
'analysis pending', "test run $id is analysis pending");
40-
} else {
41-
push @statuses, $r->current_run_status_description;
33+
subtest 'runs and statuses' => sub {
34+
plan tests => 10;
35+
36+
my %h = map { $_ => 1 } (1234, 4330, 4999, 5222, 100000);
37+
my @other_statuses = ();
38+
for my $r ($schema->resultset(q[Run])->search({})->all()) {
39+
my $id = $r->id_run;
40+
if ($h{$id}) {
41+
cmp_ok ($r->current_run_status_description, 'eq',
42+
'analysis pending', "test run $id is analysis pending");
43+
} else {
44+
push @other_statuses, $r->current_run_status_description;
45+
}
4246
}
43-
}
44-
is (scalar(grep { $_ eq 'analysis pending' } @statuses), 0,
45-
'other test runs are not analysis pending');
47+
is (scalar(grep { $_ eq 'analysis pending' } @other_statuses), 0,
48+
'other test runs are not analysis pending');
49+
50+
my $runner = npg_pipeline::daemon::analysis->new(npg_tracking_schema => $schema);
51+
is ($runner->manufacturer_name, 'Illumina', 'default manufacturer name');
52+
my @run_ids = sort { $a <=> $b } map { $_->id_run }
53+
$runner->runs_with_status('analysis pending');
54+
is (join(q[,], @run_ids), '1234,4330,4999,5222', 'correct Illumina runs IDs');
55+
56+
$runner = npg_pipeline::daemon::analysis->new(
57+
manufacturer_name => 'Element Biosciences',
58+
npg_tracking_schema => $schema
59+
);
60+
is ($runner->manufacturer_name, 'Element Biosciences',
61+
'manufacturer name as set');
62+
@run_ids = map { $_->id_run } $runner->runs_with_status('analysis pending');
63+
ok ((@run_ids == 1) && ($run_ids[0] == 100000), 'One Element Biosciences run');
64+
};
4665

4766
my $rf_path = '/some/path';
4867

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
- id_manufacturer: 20
3+
name: Element Biosciences
4+
- id_manufacturer: 10
5+
name: Illumina
6+
- id_manufacturer: 16
7+
name: Roche/454

t/data/dbic_fixtures/100-InstrumentFormat.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,11 @@
3030
default_columns: 4
3131
days_between_washes: 28
3232
runs_between_washes: 1
33+
- id_instrument_format: 12
34+
id_manufacturer: 20
35+
model: AVITI23
36+
iscurrent: 1
37+
default_tiles: 0
38+
default_columns: 0
39+
days_between_washes: 30
40+
runs_between_washes: 1

t/data/dbic_fixtures/200-Instrument.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,12 @@
106106
iscurrent: 1
107107
ipaddr:
108108
instrument_comp: HS1
109+
- id_instrument: 70
110+
name: AVITI2301
111+
id_instrument_format: 12
112+
external_name: ''
113+
serial: ''
114+
iscurrent: 1
115+
ipaddr: ~
116+
instrument_comp: ~
109117

t/data/dbic_fixtures/300-Run.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,4 +379,18 @@
379379
id_run_pair: ~
380380
is_paired: 0
381381
priority: 3
382+
team: A
383+
- actual_cycle_count: 316
384+
batch_id: ~
385+
expected_cycle_count: 316
386+
flowcell_id: ~
387+
folder_name: 'elembio_run'
388+
folder_path_glob: 't/data'
389+
id_instrument: 70
390+
id_instrument_format: 12
391+
id_run: 100000
392+
id_run_pair: ~
393+
is_paired: 1
394+
priority: 1
382395
team: A
396+

t/data/dbic_fixtures/400-RunStatus.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,22 @@
113113
id_run_status_dict: 4
114114
id_user: 7
115115
iscurrent: 1
116+
- id_run_status: 45
117+
id_run: 100000
118+
date: 2024-11-23 02:14:17
119+
id_run_status_dict: 2
120+
id_user: 7
121+
iscurrent: 0
122+
- id_run_status: 46
123+
id_run: 100000
124+
date: 2024-11-23 12:23:10
125+
id_run_status_dict: 4
126+
id_user: 7
127+
iscurrent: 0
128+
- id_run_status: 47
129+
id_run: 100000
130+
date: 2024-11-23 12:44:40
131+
id_run_status_dict: 6
132+
id_user: 7
133+
iscurrent: 1
134+

t/dbic_util.pm

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,6 @@ sub test_schema_mlwh {
2525
);
2626
}
2727

28-
sub test_schema_wh {
29-
my ($self, $fixture_path) = @_;
30-
return $self->create_test_db(
31-
'npg_warehouse::Schema', $fixture_path
32-
);
33-
}
34-
3528
no Moose;
3629
__PACKAGE__->meta->make_immutable();
3730
1;

0 commit comments

Comments
 (0)