Index: /tags/ipp-pv3-20140717/ippScripts/scripts/sc_remote_poll.pl
===================================================================
--- /tags/ipp-pv3-20140717/ippScripts/scripts/sc_remote_poll.pl	(revision 37486)
+++ /tags/ipp-pv3-20140717/ippScripts/scripts/sc_remote_poll.pl	(revision 37487)
@@ -164,13 +164,19 @@
 while (my $line = <STATFILE>) {
     chomp $line;
-    unless ($line =~ /dbinfo/) { next; }
+#    unless ($line =~ /dbinfo/) { next; }
 
     my @words = split (" ", $line);
 
-    my ($stage_id, $class_id) = get_stage_id_from_dbinfo ($words[0]);
-    print STDERR "stage_id : $stage_id, class_id: $class_id\n";
+    my ($stage_id, $class_id, $component) = get_stage_id_from_filename ($words[0]);
+    unless(defined($stage_id)) { 
+	print STDERR "Unable to convert file: $words[0]\n";
+	next;
+    }
+#    print STDERR "stage_id : $stage_id, class_id: $class_id, \n";
 
     if ($words[1] eq "PASS") {
-        push @dbinfo_files, $words[0];
+	if ($line =~ /dbinfo/) {
+	    push @dbinfo_files, $words[0];
+	}
         $stage_pass{$stage_id} = 1;
         $Npass ++;
@@ -189,4 +195,11 @@
 if (1) {
   foreach my $file (@dbinfo_files) {
+      my ($stage_id, $class_id) = get_stage_id_from_dbinfo ($file);
+      if (defined($stage_part{$stage_id})||
+	  defined($stage_fail{$stage_id})) { 
+	  print STDERR "Skipping $file as it is not complete: " . $stage_part{$stage_id} . " " . $stage_fail{$stage_id} . "\n";
+	  next;
+
+      }
       open(DBF,"$file") || warn "Missing file $file\n";
       my $cmd = <DBF>;
@@ -465,4 +478,34 @@
 }
 
+sub get_stage_id_from_filename {
+    my $file = shift;
+    my $stage = shift;
+    my $stage_id = -1;
+    my $class_id = '';
+
+    if ($stage eq 'chip') {
+        ($stage_id, $class_id, $component) = $file =~ /ch\.(\d*).(XY\d\d).([\w\.]+)$/;
+    }
+    elsif ($stage eq 'camera') {
+        if ($file =~ /XY/) {
+            ($stage_id, $class_id, $component) = $file =~ /cm\.(\d*).(XY\d\d)\.([\w\.]+)$/;
+        }
+        else {
+            ($stage_id, $component) = $file =~ /cm\.(\d*)\.([\w\.]+)$/;
+            $class_id = 0;
+        }
+    }
+    elsif ($stage eq 'warp') {
+        ($stage_id, $class_id, $component) = $file =~ /wrp\.(\d*)\.(skycell.\d\d\d\d.\d\d\d).([\w\.]+)$/;
+    }
+    elsif ($stage eq 'stack') {
+        ($stage_id, $component) = $file =~ /stk\.(\d*)\.([\w\.]+)$/;
+        $class_id = 0;
+    }
+    return($stage_id,$class_id,$component);
+}
+
+
+
 sub fail_component {
     my $remote_id = shift;
