[Orca-users] orca confusing plots with each other

Rayman, Mark (IDS GMDS) mark_rayman at ml.com
Fri Jan 9 09:47:16 PST 2004


I think I have discovered the cause of the behavior I described yesterday in my message from yesterday.

This behavior was also descried in a posting last November and December by Cameron Paine.

In lib/Orca/SourceFile.pm (at around line 695) we find:
      if (defined $substituted_data_expression) {
        $choose_data_expr .= "    '$name_with_subgroup', $substituted_data_expression,\n";
        unless (defined $rrd_data_files_ref->{$name_with_subgroup}) {
          my $rrd_file = Orca::RRDFile->new($group_index,
                                            $subgroup_name,
                                            "${data_type}_${original_data_expression}",
                                            $plot,
                                            $j);
          $rrd_data_files_ref->{$name_with_subgroup} = $rrd_file;
        }
        $self->[I_ALL_RRD_REF]            = $rrd_data_files_ref;
        $my_rrd_list{$name_with_subgroup} = 1;
        push(@my_rrds, $name_with_subgroup);
708:    push(@my_short_rrds, $short_name_with_subgroup);
      }
    }
711:# Generate a new plot for these data.
    my $image;
    my $all_names_with_subgroup = join(',', @name_with_subgroup);
    if (defined ($image = $image_files_ref->{hash}{$all_names_with_subgroup})){
      $image->add_rrds(@my_rrds);
    } else {
      $image = Orca::ImageFile->new($group_index,
                                    $subgroup_name,
                          >>>>>>    join(',', @my_short_rrds),
                                    join(',', @name_without_subgroup),
                                    $plot,
                                    $rrd_data_files_ref,
                                    \@my_rrds);
      $image_files_ref->{hash}{$all_names_with_subgroup} = $image;
      push(@{$image_files_ref->{list}}, $image);
      push(@{$config_plots[$old_i]{creates}}, $image);
    }

Notice the third argument to Orca:ImageFIle->new (marked with >>>>>>>).  This is the argument used to create the name of the PNG file.

This argument (@my_short_rrds) is only populated with the (group, sub group, etc.) of a particular data set if the current file contains that data point.  If you have a case which data for a given
plot is spread out amongst different files, the PNG will be named for the data point which the first file in group contains.  E.g.

Suppose we have two files file1 and file2:

file1 contains:
time		metric1
123456	99
...

file2 contains:
time		metric2
123456	98

and we have a group and plot definitions of

group foo {
find_files 			file[12]   #no () for subgroups
comumn_description	first_line
...
}

plot {	#plot1
source	foo
data		metric1
data		metric2
}

plot {	#plot2
source	foo
data		metric1
}

When orca processes each file in the group, it will process each file in order.  It will see file1.  It then tries to update the plots with data from this file.  It sees that there is data in the file
for plot1.  The first time around it needs to compute and create the PNG filename.  The name is made up of the group, subgroup, and column_names relevant to the plot.  The bug is that when the name is
created, it only takes the column names of the data points of the plot that are contained in the current file (which is file1).  So the name of the file will be:  foo__guage_metric1.png, since this is
the only valid data point in file1.  When it processes file2, it adds the data to the plot correctly, but is does not regenerate the name.  The name should have been foo__guage_metric1,_metric2.png.

This would have been fine, except that when plot2 is created, it will also be named foo__guage_metric1.png, and this png will clobber the other one.

I hope I was clear.

The solution would be is to move line 708 above to outside, its enclosing 'if (defined $substitute_data_expression)' .  This way all the data points would included in the filename, regardless of
whether they happen to be in the current file.

Another, perhaps better solution would be the allowance of user defined plot names, similar to group names, which would be included in the filename, to guarantee uniqueness.

Thanks

Mark 
==========================================
Mark Rayman
VP Market Data Product Management
95 Greene Street
201 671 5435
PAGER: 1888 MERRIL0
Mark_Rayman at ml.com






More information about the Orca-users mailing list