App-Oozie
view release on metacpan or search on metacpan
lib/App/Oozie/Deploy/Validate/Spec/Workflow.pm view on Meta::CPAN
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 ) {
$self->logger->warn(
sprintf 'Failed to close %s: %s',,
$file,
$!,
);
}
# ====================================================================== #
if ( !$validation_queue_check ) {
$logger->error( 'FIXME !!! queue configuration parameter in workflow.xml is not mentioned..Please set queue parameter either using --conf spark.yarn.queue or mapreduce.job.queuename. you are not allowed to deploy workflows in root.mapred or r...
$validation_errors++;
$total_errors++;
}
my $prop = $xml_in->{parameters}
&& $xml_in->{parameters}{property}
? $xml_in->{parameters}{property}
: undef
;
my $global_prop = $xml_in->{global}
&& $xml_in->{global}{configuration}
&& $xml_in->{global}{configuration}{property}
? $xml_in->{global}{configuration}{property}
: undef
;
$logger->info( sprintf 'XML key validation for %s', $file );
# check some values in the XML files
# in workflow.xml, check errorEmailTo, various params, and display a warning
my $error_email_field_name = 'errorEmailTo';
my @contact_mail = $prop
? (
map { $_->{value} }
( run in 0.477 second using v1.01-cache-2.11-cpan-99c4e6809bf )