App-Oozie

 view release on metacpan or  search on metacpan

lib/App/Oozie/Deploy/Validate/Spec/Workflow.pm  view on Meta::CPAN

                $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} }
                            grep { $_->{name} eq $error_email_field_name }
                            @{ $prop }
                            )
                        : ()
                        ;

     # check if global conf parameter contains mapred or default queue configuration
    my @queue_array = $global_prop
                    ? (
                        map  { $_->{value} }
                        grep { $_->{name} =~ m{ queuename }xms }
                        @{ $global_prop }
                        )
                    : ()
                    ;

    $self->validate_xml_property(
        \$validation_errors,
        \$total_errors,
        $prop
    );

    $self->validate_xml_property(
        \$validation_errors,
        \$total_errors,
        $global_prop,
        'global'
    );

    foreach my $queue_value (@queue_array) {
        if ( $queue_value =~ 'default' || $queue_value =~ 'mapred' ) {
            $logger->error(
                'FIXME !!! mapreduce.job.queuename 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 ( ! @contact_mail ) {
        $logger->warn(
            sprintf 'FIXME !!! no `%s` parameter in workflow.xml; you will not get error emails',
                        $error_email_field_name,
        );
        $validation_errors++;
        $total_errors++;
    }
    else {
        my $validator = $self->email_validator;
        if ( ! $validator->( $self, @contact_mail ) ) {
            $logger->warn(
                sprintf '%s=`%s` is invalid',
                        $error_email_field_name,
                        @contact_mail
            );
            $validation_errors++;
            $total_errors++;
        }
    }

    if ( my $action = $xml_in->{action} ) {
        foreach my $name ( keys %{ $action } ) {
            my $len = length $name;
            next if $len <= $max_node_name_len;

            # See  https://issues.apache.org/jira/browse/OOZIE-2168
            my $msg = <<"LONG_ACTION_NAME";
FIXME !!! The action name is longer than $max_node_name_len characters (it is $len characters to be precise)

    $name

The restriction to $max_node_name_len characters is a hardcoded limit in the
Oozie Java code (and its MySQL metastore).

Plese rename it as your job will fail eventually at run time.

LONG_ACTION_NAME
            $logger->warn( $msg );
            $validation_errors++;
            $total_errors++;
        }
        my($action_validation_errors,
           $action_total_errors



( run in 0.680 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )