Skip to content

Commit

Permalink
Merge branch 'hotfix/4.0.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
keiranmraine committed Mar 31, 2017
2 parents 3a2a861 + 79ef395 commit e9d3e36
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
Binary file modified docs.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion lib/PCAP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use FindBin qw($Bin);
use File::Which qw(which);
# don't use autodie, only core perl in here

our $VERSION = '4.0.1';
our $VERSION = '4.0.2';
our @EXPORT = qw($VERSION _which);

const my $LICENSE =>
Expand Down
16 changes: 14 additions & 2 deletions lib/PCAP/Threaded.pm
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,13 @@ sub run {
my $function_ref = $self->{'functions'}->{$function_name}->{'code'};
my $thread_count = $self->{'functions'}->{$function_name}->{'threads'};

my $start_interval = 6; # initial scaling
if($self->{'threads'} >= 8) {
# when core count is higher spread the scaling up over 2 minutes
$start_interval = int 120 / $self->{'threads'};
$start_interval = 6 if($start_interval < 6);
}

# uncoverable branch true
if($thread_count > 1 && $CAN_USE_THREADS) {
# reserve 0 for when people want to use 'success_exists/touch_success' for non-threaded steps
Expand All @@ -146,12 +153,13 @@ sub run {
while(threads->list(threads::all()) < $thread_count && $index <= $iterations) {
while($self->need_backoff) {
warn "Excessive load average, take a break... have a Kit-Kat!\n";
sleep 20;
sleep 30;
}
threads->create($function_ref, $index++, @params);
last if($index > $iterations);
sleep 2;
sleep $start_interval;
}
$start_interval = 2; # once the initial scale up is complete start interval can be shorter.
sleep $self->thread_join_interval while(threads->list(threads::joinable()) == 0);
for my $thr(threads->list(threads::joinable())) {
$thr->join;
Expand Down Expand Up @@ -263,6 +271,10 @@ sub external_process_handler {
catch { die $_; };

unlink $script; # only leave scripts if we fail
if($ENV{PCAP_THREADED_REM_LOGS}) {
unlink $err;
unlink $out;
}
}

return 1;
Expand Down
2 changes: 1 addition & 1 deletion setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ SETUP_DIR=$INIT_DIR/install_tmp
mkdir -p $SETUP_DIR

# check for cgpBigWig
if [ -e "$INST_PATH/bin/bwjoin" ]; then
if [ -e "$INST_PATH/bin/detectExtremeDepth" ]; then
echo -e "\tcgpBigWig installation found";
else
echo -e "\tERROR: Please see README.md and install cgpBigWig";
Expand Down

0 comments on commit e9d3e36

Please sign in to comment.