Branch Coverage

lib/Bio/Graphics/Browser2/Render/Slave/AWS_Balancer.pm
Criterion Covered Total %
branch 30 228 13.1


line true false branch
35 0 1 unless $args{-'conf'}
36 0 1 unless -e $args{-'conf'}
65 0 0 if ($self->running_as_instance)
67 0 0 if $credentials
78 0 0 if @_
85 1 1 if @_
102 0 0 if $self->daemon
111 0 0 unless eval { do { $self->ec2 } }
114 0 0 if $killed
127 0 0 if (not $pid and my $pidfile = $self->pidfile)
128 0 0 unless my $fh = 'IO::File'->new($pidfile)
133 0 0 if -e $self->pidfile
134 0 0 if defined $pid
158 0 7 unless my $lt = $self->load_table
161 17 18 if $load >= $l
166 0 1 unless (shift())->option('SLAVE', 'instance_type')
167 0 1 unless (shift())->option('SLAVE', 'spot_bid')
170 0 0 @p ? :
173 0 0 if ($self->running_as_instance) { }
184 0 0 if ($self->running_as_instance) { }
193 0 0 if ($self->running_as_instance) { }
207 0 0 unless my $image = $self->ec2->describe_images($self->slave_image_id)
217 0 0 unless my $snap = shift @snaps
226 0 0 if ($self->running_as_instance) { }
243 0 0 if $sg
248 0 0 $self->running_as_instance ? :
255 0 0 if $self->slave_ssh_key
261 0 0 unless $sg->update
276 0 0 unless $self->running_as_instance
282 0 0 unless $self->running_as_instance
322 0 0 unless open my $in, '<', $conf_file
323 0 0 unless open my $out, '>', "$conf_file.new"
331 0 0 unless rename "$conf_file", "$conf_file.bak"
332 0 0 unless rename "$conf_file.new", "$conf_file"
344 0 0 $self->running_as_instance ? :
406 0 0 if (-e '/tmp/gbrowse_load')
411 0 0 unless my $stats = $self->{'pr'}->get
428 0 0 if ($current < $min) { }
0 0 elsif ($current > $max) { }
440 0 0 if ($c->isa('VM::EC2::Spot::InstanceRequest')) { }
0 0 elsif ($c->isa('VM::EC2::Instance')) { }
453 0 0 if $reconfigure
465 0 0 if ($state eq 'fulfilled' and $instance and $instance->instanceState eq 'running') { }
0 0 elsif ($sr->current_state =~ /cancelled|failed/) { }
468 0 0 unless $self->ping_slave($instance)
488 0 0 $subnet ? :
0 0 $key ? :
504 0 0 if (ref $v and ref $v eq 'ARRAY') { }
517 0 0 unless @requests
534 0 0 $self->running_as_instance ? :
541 0 0 if (@a) { }
563 1 0 unless $level <= $self->verbosity
572 1 0 if not $self->{'pid'} or $self->{'pid'} != $$
574 0 0 unless my $ec2 = eval { do { $self->ec2 } }
580 0 0 if (@instances)
587 0 0 if (my(@requests) = grep({$_->current_state eq 'open';} $self->pending_spot_requests))
593 0 0 if (my $sg = $self->{'slave_security_group'})
594 0 0 if (@instances)
603 0 0 if $self->pidfile
639 0 0 unless defined $child
640 0 0 if $child
648 0 0 if (my $l = $self->pidfile)
649 0 0 unless my $fh = 'IO::File'->new($l, '>')
651 0 0 unless $fh->print($$)
656 0 0 if $self->logfh
669 0 0 unless my $u = $self->user
671 0 0 unless defined $uid
672 0 0 unless setuid($uid)
678 0 0 unless my $l = $self->logfile
679 0 0 unless my $fh = 'IO::File'->new($l, '>>')
700 0 1 if exists $self->{'options'}{'LOAD TABLE'}
701 0 1 unless open my $f, $self->conf_file
704 3 0 if $line =~ /^\[([^]]+)\]/
708 0 1 unless exists $self->{'options'}{'LOAD TABLE'} and exists $self->{'options'}{'SLAVE'}
714 1 2 if (uc $stanza eq 'LOAD TABLE') { }
726 0 5 unless @tokens == 3
736 4 6 unless my($option, $value) = $line =~ /^(\S+)\s*=\s*(.+)/
746 2 16 if ($line =~ /^\[/)
757 2 20 if (@{$self->{'pushback'};})
762 2 23 unless defined(my $line = <$fh>)
764 1 22 if $line =~ /^\s*#/
766 4 18 unless $line =~ /\S/
779 0 0 unless -t \*STDIN
814 0 0 if $needed <= 0
825 0 0 unless $vg eq 'volumes'
833 0 0 if ($volumes{$pv} + $needed < 1000)
842 0 0 unless $self->ssh('sudo umount /opt/gbrowse')
844 0 0 if ($to_resize) { }
853 0 0 unless $self->ssh('sudo lvextend -l +100%FREE /dev/volumes/gbrowse')
856 0 0 unless $self->ssh('sudo e2fsck -f -p /dev/volumes/gbrowse')
859 0 0 unless $self->ssh('sudo resize2fs -p /dev/volumes/gbrowse')
862 0 0 unless $self->ssh('sudo mount /opt/gbrowse')
869 0 0 if $self->manager
885 0 0 unless my $action = shift()
886 0 0 $action eq 'stop' ? :
901 0 0 unless $vg eq 'volumes'
912 0 0 unless @vols
915 0 0 unless $self->ssh('sudo umount /opt/gbrowse')
922 0 0 unless $self->ssh('sudo mount /opt/gbrowse')
933 0 0 unless my $vol = $self->ec2->create_volume(-'availability_zone', $self->placement, -'size', $size)
936 0 0 unless $vol->current_status eq 'available'
938 0 0 unless my $a = $vol->attach($self, $ebs_device)
940 0 0 unless $a->current_status eq 'attached'
945 0 0 unless $self->ssh("sudo pvcreate $local_device")
948 0 0 unless $self->ssh("sudo vgextend volumes $local_device")
961 0 0 unless $mapping
967 0 0 unless $self->ssh('sudo vgchange -an volumes')
971 0 0 unless my $a = $volume->detach
976 0 0 unless my $snapshot = $volume->create_snapshot('created by Bio::Graphics::Browser2::Render::Slave::StagingServer')
978 0 0 unless $snapshot->current_status eq 'completed'
984 0 0 unless my $new_volume = $self->ec2->create_volume(-'availability_zone', $zone, -'size', $new_size, -'snapshot_id', $snapshot)
988 0 0 unless $new_volume->current_status eq 'available'
997 0 0 unless $self->ssh("sudo pvresize $device")
998 0 0 unless $self->ssh('sudo vgchange -ay volumes')