21 my @opt = <<'=back' =~ /B<--(\S+)>/g;
29 Sleep that much between two annotations.
31 =item B<--showprogress!>
39 Make sure all annotations are in the distcontext table. Intended as a
40 cronjob that runs only 4 times per day or so.
44 2015/2016 slaven sends so many annotations and wants to see them
45 sooner than the default.
51 use lib
"$FindBin::Bin/../lib";
57 use File
::Basename
qw(dirname);
58 use File
::Path
qw(mkpath);
63 use Hash
::Util
qw(lock_keys);
64 use Time
::HiRes
qw(sleep);
68 lock_keys
%Opt, map { /([^=|!]+)/ } @opt;
79 use lib
"$FindBin::Bin/../CPAN-Blame/lib";
80 use CPAN
::Blame
::Config
::Cnntp
;
82 $workdir = File
::Spec
->catdir
83 ($CPAN::Blame
::Config
::Cnntp
::Config
->{solver_vardir
},
86 use IPC
::ConcurrencyLimit
;
88 my($basename) = File
::Basename
::basename
(__FILE__
);
89 my $limit = IPC
::ConcurrencyLimit
->new
92 path
=> "$workdir/IPC-ConcurrencyLimit-$basename",
94 my $limitid = $limit->get_lock;
96 warn "Another process appears to be still running. Exiting.";
102 my $dbi = DBI
->connect ("dbi:Pg:dbname=analysis");
104 my $sth = mypgdbi
()->prepare("select yaml from distcontext where distv=?");
105 my $sth2 = mypgdbi
()->prepare("update distcontext set yaml=? where distv=? and yaml=?");
106 setpriority(0, 0, 5); # renice
107 my $annofile = "$FindBin::Bin/../annotate.txt";
109 unless (open $fh, $annofile) {
116 ANNOLINE
: while (<$fh>) {
118 next ANNOLINE
if /^\s*$/;
119 my($dist,$splain) = split " ", $_, 2;
120 $anno->{$dist} = $splain;
123 my $cntdown = keys %$anno;
126 for my $distv (keys %$anno) {
127 $sth->execute($distv);
128 my($ystr) = $sth->fetchrow_array;
130 warn "Record n'existe: $distv\n";
132 if (my $y = eval { YAML
::XS
::Load
($ystr) }) {
133 if (!$y->{annotation
} || $y->{annotation
} ne $anno->{$distv}) {
134 $y->{annotation
} = $anno->{$distv};
135 $sth2->execute(YAML
::XS
::Dump
($y), $distv, $ystr);
136 warn sprintf "%s: %s\n", scalar localtime, $distv;
141 if ($Opt{showprogress
}) {
142 unless ($cntdown % 10) {
143 printf "\r%8d %-60s", $cntdown, $distv;
155 # cperl-indent-level: 4