# HG changeset patch # User Vincent Tondellier # Date 1455990971 -3600 # Node ID d024bf1f4eabd9caac749e51f1ed055298ba2c9b # Parent 3b95550f4189962d7ee3faa454de3068a7cf4af2 Remove unused files, we use minion now diff -r 3b95550f4189 -r d024bf1f4eab bin/gearman_decode_worker.pl --- a/bin/gearman_decode_worker.pl Sat Feb 20 18:54:57 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -#!/usr/bin/env perl - -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -use Mojo::Base -strict; -use lib 'lib'; - -use Mojo::JSON qw/decode_json/; -use Mojo::Util qw/decode slurp/; -use Mojo::Loader qw/load_class/; -use File::Temp; -use Gearman::Worker; -use Mojolicious; -use Mojo::Home; - -sub load_config { - my $app = Mojolicious->new; - $app->home(Mojo::Home->new("$FindBin::Bin/../")); - $app->moniker("CrashTest"); - return $app->plugin('Config'); -} - -my $config = load_config(); - -my $storage_class = $config->{Storage}->{Type}; -if (my $e = load_class($storage_class)) { - die ref $e ? "Exception: $e" : 'Not found!'; -} - -my $storage = $storage_class->new(config => $config->{Storage}); - -my $worker = Gearman::Worker->new(job_servers => $config->{DecodeQueue}->{GearmanServers}); - -$worker->register_function("dump_decode", 60, sub { - my $args = $_[0]->arg; - - my $jsonin = decode_json($args); - - my $file = File::Temp->new(); - binmode($file); - print $file $jsonin->{file}; - - my $cmd = $config->{Dumper}->{JSONStackwalker} . " " . $file->filename . " " . $config->{Dumper}->{SymbolsPath}; - my $out = qx($cmd 2>/dev/null) or die $!; - - my $pjson = $json->decode($out); - - # Create json for the params - $pjson->{client_info} = $jsonin->{params}; - - my $uuidstr = $jsonin->{uuid}; - $storage->store_dump($uuidstr, slurp $file); - $storage->store_processed_data($uuidstr, $pjson); - - return $json->encode($pjson); -}); - -$worker->work() while 1; diff -r 3b95550f4189 -r d024bf1f4eab lib/CrashTest/Decode/Queue/Gearman.pm --- a/lib/CrashTest/Decode/Queue/Gearman.pm Sat Feb 20 18:54:57 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -package CrashTest::Decode::Queue::Gearman; -use Mojo::Base -base; -use Mojo::JSON qw/j/; -use Gearman::Client; - -has [ qw/config gearman/ ]; - -sub new { - my $self = shift->SUPER::new(@_); - - $self->gearman(Gearman::Client->new( - job_servers => $self->config->{GearmanServers}) - ); - - return $self; -} - -sub decode { - my ($self, $file, $paramshash, $uuidstr, $cb) = @_; - - my $args = j { - file => $file->slurp, - params => $paramshash, - uuid => $uuidstr - }; - - $self->gearman->dispatch_background('dump_decode', $args); - - $cb->({ status => "backgrounded" }); -} - -1; diff -r 3b95550f4189 -r d024bf1f4eab lib/CrashTest/Decode/Queue/NoQueue.pm --- a/lib/CrashTest/Decode/Queue/NoQueue.pm Sat Feb 20 18:54:57 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -package CrashTest::Decode::Queue::NoQueue; -use Mojo::Base -base; -use Mojo::JSON qw/decode_json/; -use File::Temp; - -has [ qw/config dumper_config storage/ ]; - -sub new { - my $self = shift->SUPER::new(@_); - - return $self; -} - -sub decode { - my ($self, $file, $paramshash, $uuidstr, $cb) = @_; - - my $fh = File::Temp->new(SUFFIX => '.dmp'); - my $dmp_file = $fh->filename; - $file->move_to($dmp_file); - - my $cmd = $self->dumper_config->{JSONStackwalker} . " $dmp_file " . $self->dumper_config->{SymbolsPath}; - my $out = qx($cmd 2>/dev/null) or die $!; - - my $pjson = decode_json($out); - - # Create json for the params - $pjson->{client_info} = $paramshash; - - $self->storage->store_dump($uuidstr, $file->slurp); - $self->storage->store_processed_data($uuidstr, $pjson); - - $cb->($pjson); -} - -1;