Multivalue attribute fix, debuging, query5 fix.
authorFrantišek Dvořák <valtri@civ.zcu.cz>
Wed, 13 Sep 2006 14:26:21 +0000 (14:26 +0000)
committerFrantišek Dvořák <valtri@civ.zcu.cz>
Wed, 13 Sep 2006 14:26:21 +0000 (14:26 +0000)
org.glite.jp.index/examples/pch06/pch.pm
org.glite.jp.index/examples/pch06/query3.pl
org.glite.jp.index/examples/pch06/query4.pl
org.glite.jp.index/examples/pch06/query5.pl

index e4bb6db..e8bf688 100644 (file)
@@ -10,15 +10,15 @@ package pch;
 use strict;
 use warnings;
 use XML::Twig;
-#use Data::Dumper;
+use Data::Dumper;
 
 our $lbattr='http://egee.cesnet.cz/en/Schema/LB/Attributes';
 our $jpsys='http://egee.cesnet.cz/en/Schema/JP/System';
 our $jpwf='http://egee.cesnet.cz/en/Schema/JP/Workflow';
 our $jplbtag='http://egee.cesnet.cz/en/WSDL/jp-lbtag';
 
-our @view_attributes=("$pch::jplbtag:IPAW_STAGE", "$pch::jplbtag:IPAW_PROGRAM", "$pch::jplbtag:IPAW_PARAM", "$pch::jplbtag:IPAW_INPUT", "$pch::jplbtag:IPAW_OUTPUT", "$pch::lbattr:CE", "$pch::lbattr:parent", "$pch::jpsys:regtime");
-#"$pch::lbattr:host", # TODO: to index server
+our @view_attributes=("$pch::jplbtag:IPAW_STAGE", "$pch::jplbtag:IPAW_PROGRAM", "$pch::jplbtag:IPAW_PARAM", "$pch::jplbtag:IPAW_INPUT", "$pch::jplbtag:IPAW_OUTPUT", "$pch::lbattr:CE", "$pch::lbattr:parent", "$pch::lbattr:host", "$pch::jpsys:regtime");
+
 
 our $debug = 0;
 our $err = 0;
@@ -129,18 +129,29 @@ sub jobs_handler {
 
        $xmlattribute = $xmljobs->first_child('attributes');
        while ($xmlattribute) {
+               my ($xmlname, $xmlvalue);
                my @values = ();
-               my ($xmlname, $xmlvalue, %attribute);
-               %attribute = ();
+               my %attribute = ();
 
                $xmlname = $xmlattribute->first_child('name');
                die "No name on '".$xmlattribute->text."'" if (!$xmlname);
+#print $xmljobid->text.": ".$xmlname->text.":\n";
+               if (exists $attributes{$xmlname->text}) {
+                       %attribute = %{$attributes{$xmlname->text}};
+               }
+#print "  prev attr: ".Dumper(%attribute)."\n";
+               if (exists $attribute{value}) {
+                       @values = @{$attribute{value}};
+               }
+#print "  prev values: ".Dumper(@values)."\n";
                $xmlvalue = $xmlattribute->first_child('value');
                while ($xmlvalue) {
+#print "  to add: ".$xmlvalue->text."\n";
                        push @values, $xmlvalue->text;
                        $xmlvalue = $xmlvalue->next_sibling('value');
                }
-               $attribute{value} = \@values;
+               @{$attribute{value}} = @values;
+#print "  new values: ".Dumper($attribute{value})."\n";
                $attribute{timestamp} = $xmlattribute->first_child('timestamp')->text;
                $xmlattribute = $xmlattribute->next_sibling('attributes');
 
index ba4098f..7182679 100644 (file)
@@ -39,8 +39,8 @@ my $debug = 0;
 my @jobs = pch::isquery($is, [
        ["$pch::jplbtag:IPAW_OUTPUT", ['EQUAL', "<string>$output</string>"]],
 ], \@attributes);
-print Dumper(@jobs) if ($debug);
 die "...so exit on error" if ($pch::err);
+print Dumper(@jobs) if ($debug);
 
 #
 # initial set from index server
index 0d82890..e51f94c 100644 (file)
@@ -20,6 +20,7 @@ my $is='https://skurut1.cesnet.cz:8902';
 my $program_name='align_warp';
 my $program_params='-m 12';
 my $runday=1;
+#my $runday=4;
 my @view_attributes = ("$pch::jplbtag:IPAW_STAGE", "$pch::jplbtag:IPAW_PROGRAM", "$pch::jplbtag:IPAW_PARAM", "$pch::jplbtag:IPAW_INPUT", "$pch::jplbtag:IPAW_OUTPUT", "$pch::lbattr:CE");
 my @attributes = ("$pch::jpsys:jobId", "$pch::jpsys:regtime", @view_attributes);
 
index d621e64..52b3327 100644 (file)
@@ -19,7 +19,6 @@ my $ps='https://skurut1.cesnet.cz:8901';
 my $is='https://skurut1.cesnet.cz:8902';
 my $program_name='align_warp';
 my $end_program_name='convert';
-my $atlas_image_program_name='convert';
 my $header="GLOBAL_MAXIMUM=4095"; # test for exact equal (scripts already prepared it)
 
 my @according_jobs = (); # sequencially jobid list
@@ -28,8 +27,8 @@ my $according_count = 0;
 
 
 # debug calls
-$pch::debug = 1;
-my $debug = 1;
+$pch::debug = 0;
+my $debug = 0;
 
 #
 # find out processes with given name and parameters
@@ -49,6 +48,7 @@ foreach my $job (@jobs) {
        my %attributes = %{$job{attributes}};
        my $dagjobid = $attributes{"$pch::lbattr:parent"}{value}[0];
 
+       print "Consider DAG $dagjobid\n" if $debug;
        if (!exists $according_jobs{$dagjobid}) {
                %job = ();
                push @according_jobs, $dagjobid;
@@ -58,9 +58,10 @@ foreach my $job (@jobs) {
                        my @value;
 
                        @value = pch::psquery($ps, $dagjobid, $attr);
-                       if (defined @value) { $job{attributes}{$attr} = \@value; }
+                       if (defined @value) { @{$job{attributes}{$attr}{value}} = @value; }
                }
                $according_jobs{$dagjobid} = \%job;
+               print "Added DAG $dagjobid\n" if $debug;
        }
 }
 undef @jobs;