App-Oozie
view release on metacpan or search on metacpan
lib/App/Oozie/Deploy/Validate/Spec/Workflow.pm view on Meta::CPAN
);
with qw(
App::Oozie::Role::Log
App::Oozie::Role::Fields::Generic
App::Oozie::Role::Validate::XML
);
has queue_conf_key_name => (
is => 'rw',
default => sub { 'mapreduce.job.queuename' },
);
has file => (
is => 'rw',
required => 1,
);
has file_size => (
is => 'ro',
default => sub {
my $file = shift->file;
my $wf_size = (stat $file )[STAT_SIZE]
|| die "$file either has zero size or I've failed to locate it";
$wf_size;
}
);
has max_wf_xml_length => (
is => 'rw',
required => 1,
);
has max_node_name_len => (
is => 'rw',
required => 1,
);
has email_validator => (
is => 'rw',
required => 1,
isa => CodeRef,
);
has spec_queue_is_missing_message => (
is => 'rw',
default => sub {
<<'NO_QUEUE_MSG';
The action configuration property "%s" is not
defined for these action(s):
%s
You don't have to add it to each individually;
you can also add a global block which adds it to all
of your action nodes at once. Example:
[% PROCESS workflow_global_xml_start %]
<property>
<name>mapreduce.job.queuename</name>
<value> PUT YOUR QUEUE NAME HERE </value>
</property>
[% PROCESS workflow_global_xml_end %]
The [% ... %] tags are probably already in your
workflow.xml.
NO_QUEUE_MSG
},
);
sub verify {
my $self = shift;
my $xml_in = shift;
my $file = $self->file;
my $wf_size = $self->file_size;
my $max_wf_xml_length = $self->max_wf_xml_length;
my $max_node_name_len = $self->max_node_name_len;
my $logger = $self->logger;
my($validation_errors, $total_errors);
if ( $wf_size > $max_wf_xml_length ) {
my $msg = sprintf <<'ETOOFAT', basename( $file ), $wf_size, $max_wf_xml_length;
Your %s has a size above the limit ( %s > %s )
please either modify it to reduce the size as
your job will fail anyway if you push it as-is.
ETOOFAT
$logger->warn( $msg );
$validation_errors++;
$total_errors++;
}
my $validation_queue_check = 0;
# ====================================================================== #
# TODO: we already have the decoded XML. Get rid of this file read
#
# check any action contains root.default or root.mapred queue conf (spark,hive or shell)
open my $FH, '<', $file or die "Cannot open $file"; ## no critic (InputOutput::RequireBriefOpen)
while(my $String = <$FH>) {
if (
$String =~ m{ (root.default) \z }xms
|| $String =~ m{ (root.mapred) \z }xms
) {
$logger->error(
'FIXME !!! queue configuration parameter in workflow.xml is set to default or mapred; you are not allowed to deploy workflows in root.mapred or root.default queue.'
);
$validation_errors++;
$total_errors++;
}
if (
$String =~ m{ (mapreduce.job.queuename) }xms
|| $String =~ m{ (spark.yarn.queue) }xms
) {
$validation_queue_check++;
}
}
if ( ! close $FH ) {
( run in 0.965 second using v1.01-cache-2.11-cpan-13bb782fe5a )