est2::Harness::IPC::Util qw/check_pipe ipc_warn pid_is_running/;
use Test2::Harness::Util::JSON qw/decode_json/;
use Test2::Harness::Instance::Message;
use Test2::Harness::Instance::Request;
use Test
;
my $json = $self->{+READ_PIPE}->read_message;
next if !$json && $! == EINTR;
last unless $json;
my $msg;
unless (eval { $msg = decode_json($json); 1 }) {
ipc_warn(error => $@, input_json => $json, input => $msg);
next;
}
$count++;
if (my $class = $msg->{class}) {
require(mod2file($class));
arent 'App::Yath::Command';
use Test2::Harness::Util::HashBase;
use Test2::Harness::Util::JSON qw/decode_json/;
use LWP;
use LWP::UserAgent;
use Getopt::Yath;
include_options(
'App::Yath::Optio
log file" unless -f $log;
die "'$log' does not look like a log file" unless $log =~ m/\.jsonl(\.(gz|bz2))?$/;
my $api_key = $settings->webclient->api_key or die "No API key was specifie
,
json => 1,
log_file => [$log],
],
);
if ($res->is_success) {
my $json = $res->decoded_content;
my $data = decode_json($json);
pr
ge Test2::Harness::Util::File::JSONL;
use strict;
use warnings;
our $VERSION = '2.000004';
use Carp qw/croak/;
use Test2::Harness::Util::JSON qw/encode_json decode_json/;
use parent 'Test2::Harness
{ shift; decode_json($_[0]) }
sub encode { shift; encode_json(@_) . "\n" }
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
Test2::Harness::Util::File::JSONL - Utility class for a JSONL file (stream)
les
encoding/decoding JSONL data.
=head1 SYNOPSIS
use Test2::Harness::Util::File::JSONL;
my $jsonl = Test2::Harness::Util::File::JSONL->new(name => '/path/to/file.jsonl');
while (1) {
ts::State;
use strict;
use warnings;
our $VERSION = '2.000004';
use Test2::Harness::Util::File::JSON;
use Scalar::Util qw/weaken/;
use Time::HiRes qw/time/;
use List::Util qw/first min sum0 max/;
us
urn $self->init_state unless -e $self->{+STATE_FILE};
my $file = Test2::Harness::Util::File::JSON->new(name => $self->{+STATE_FILE});
my ($ok, $err);
for (1 .. 5) {
my $state;
umask($self->{+STATE_UMASK});
my $ok = eval {
my $file = Test2::Harness::Util::File::JSON->new(name => $self->{+STATE_FILE});
$file->rewrite($state_copy);
1;
};
my
file = $self->{+SUMMARY_FILE}) {
require Test2::Harness::Util::File::JSON;
Test2::Harness::Util::File::JSON->new(name => $file)->write($new);
}
}
sub _audit {
my $self = shift
h::Schema::Util qw/schema_config_from_settings format_duration/;
use Test2::Harness::Util::JSON qw/decode_json/;
use App::Yath::Schema::RunProcessor;
use parent 'App::Yath::Command';
use Test2::Harn
ath database" }
sub group { ["database", 'log parsing'] }
sub cli_args { "[--] event_log.jsonl[.gz|.bz2]" }
sub description { "Publish a log file directly to a yath database" }
sub run {
id log file" unless -f $file;
die "'$file' does not look like a log file" unless $file =~ m/\.jsonl(\.(gz|bz2))?$/;
my $lines = 0;
my $fh;
if ($file =~ m/\.bz2$/) {
$fh = IO::
onents(
"InflateColumn::DateTime",
"InflateColumn::Serializer",
"InflateColumn::Serializer::JSON",
);
__PACKAGE__->table("sweeps");
__PACKAGE__->add_columns(
"sweep_id",
{ data_type => "bigi
onents(
"InflateColumn::DateTime",
"InflateColumn::Serializer",
"InflateColumn::Serializer::JSON",
);
__PACKAGE__->table("source_subs");
__PACKAGE__->add_columns(
"source_sub_id",
{ data_typ
onents(
"InflateColumn::DateTime",
"InflateColumn::Serializer",
"InflateColumn::Serializer::JSON",
);
__PACKAGE__->table("job_tries");
__PACKAGE__->add_columns(
"job_try_uuid",
{ data_type =
onents(
"InflateColumn::DateTime",
"InflateColumn::Serializer",
"InflateColumn::Serializer::JSON",
);
__PACKAGE__->table("api_keys");
__PACKAGE__->add_columns(
"value",
{ data_type => "uuid"
onents(
"InflateColumn::DateTime",
"InflateColumn::Serializer",
"InflateColumn::Serializer::JSON",
);
__PACKAGE__->table("config");
__PACKAGE__->add_columns(
"config_id",
{ data_type => "int
onents(
"InflateColumn::DateTime",
"InflateColumn::Serializer",
"InflateColumn::Serializer::JSON",
);
__PACKAGE__->table("events");
__PACKAGE__->add_columns(
"event_uuid",
{ data_type => "uu
onents(
"InflateColumn::DateTime",
"InflateColumn::Serializer",
"InflateColumn::Serializer::JSON",
);
__PACKAGE__->table("session_hosts");
__PACKAGE__->add_columns(
"session_host_id",
{ data
onents(
"InflateColumn::DateTime",
"InflateColumn::Serializer",
"InflateColumn::Serializer::JSON",
);
__PACKAGE__->table("binaries");
__PACKAGE__->add_columns(
"event_uuid",
{ data_type => "
onents(
"InflateColumn::DateTime",
"InflateColumn::Serializer",
"InflateColumn::Serializer::JSON",
);
__PACKAGE__->table("job_try_fields");
__PACKAGE__->add_columns(
"event_uuid",
{ data_typ
onents(
"InflateColumn::DateTime",
"InflateColumn::Serializer",
"InflateColumn::Serializer::JSON",
);
__PACKAGE__->table("source_files");
__PACKAGE__->add_columns(
"source_file_id",
{ data_t
onents(
"InflateColumn::DateTime",
"InflateColumn::Serializer",
"InflateColumn::Serializer::JSON",
);
__PACKAGE__->table("coverage_manager");
__PACKAGE__->add_columns(
"coverage_manager_id",
onents(
"InflateColumn::DateTime",
"InflateColumn::Serializer",
"InflateColumn::Serializer::JSON",
);
__PACKAGE__->table("projects");
__PACKAGE__->add_columns(
"project_id",
{ data_type => "
onents(
"InflateColumn::DateTime",
"InflateColumn::Serializer",
"InflateColumn::Serializer::JSON",
);
__PACKAGE__->table("coverage");
__PACKAGE__->add_columns(
"event_uuid",
{ data_type => "
data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
"metadata",
{ data_type => "json", default_value => \"null", is_nullable => 1 },
);
__PACKAGE__->set_primary_key("coverage_id");
_
onents(
"InflateColumn::DateTime",
"InflateColumn::Serializer",
"InflateColumn::Serializer::JSON",
);
__PACKAGE__->table("hosts");
__PACKAGE__->add_columns(
"host_id",
{ data_type => "intege