[Bio] / FigKernelPackages / FIG.pm Repository:
ViewVC logotype

Diff of /FigKernelPackages/FIG.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.429, Mon Jan 23 19:20:54 2006 UTC revision 1.430, Wed Jan 25 18:57:05 2006 UTC
# Line 955  Line 955 
955          $db->create_table(tbl => "sim_queue",          $db->create_table(tbl => "sim_queue",
956                    flds => "qid varchar(32), chunk_id INTEGER, seek INTEGER, len INTEGER, " .                    flds => "qid varchar(32), chunk_id INTEGER, seek INTEGER, len INTEGER, " .
957                    "assigned BOOL, finished BOOL, output_file varchar(255), " .                    "assigned BOOL, finished BOOL, output_file varchar(255), " .
958                      "worker_pid INTEGER, start_time timestamp, " .
959                    "assignment_expires INTEGER, worker_info varchar(255)"                    "assignment_expires INTEGER, worker_info varchar(255)"
960                   );                   );
961      }      }
# Line 974  Line 975 
975      $chunk_begin = 0;      $chunk_begin = 0;
976      $seq_idx = 0;      $seq_idx = 0;
977    
     my(@seeks);  
   
978      my $tmpfile = "$FIG_Config::temp/simseek.$$";      my $tmpfile = "$FIG_Config::temp/simseek.$$";
979      open(my $tmpfh, ">$tmpfile") or confess "Cannot open tmpfile $tmpfile: $!";      open(my $tmpfh, ">$tmpfile") or confess "Cannot open tmpfile $tmpfile: $!";
980    
# Line 1000  Line 999 
999              my $chunk_end = tell($seq_fh);              my $chunk_end = tell($seq_fh);
1000              my $chunk_len = $chunk_end - $chunk_begin;              my $chunk_len = $chunk_end - $chunk_begin;
1001    
1002              push(@seeks, [$cpool_id, $chunk_idx, $chunk_begin, $chunk_len]);              print $tmpfh join("\t", $cpool_id, $chunk_idx, $chunk_begin, $chunk_len, 'FALSE', 'FALSE',
1003              print $tmpfh join("\t", $cpool_id, $chunk_idx, $chunk_begin, $chunk_len, 'FALSE', 'FALSE'), "\n";                                '\N', '\N', '\N', '\N', '\N'), "\n";
1004              $chunk_idx++;              $chunk_idx++;
1005              $chunk_begin = $chunk_end;              $chunk_begin = $chunk_end;
1006              $cur_size = 0;              $cur_size = 0;
# Line 1013  Line 1012 
1012          my $chunk_end = tell($seq_fh);          my $chunk_end = tell($seq_fh);
1013          my $chunk_len = $chunk_end - $chunk_begin;          my $chunk_len = $chunk_end - $chunk_begin;
1014    
1015          print $tmpfh join("\t", $cpool_id, $chunk_idx, $chunk_begin, $chunk_len, 'FALSE', 'FALSE'), "\n";          print $tmpfh join("\t", $cpool_id, $chunk_idx, $chunk_begin, $chunk_len, 'FALSE', 'FALSE',
1016          push(@seeks, [$cpool_id, $chunk_idx, $chunk_begin, $chunk_len]);                            '\N', '\N', '\N', '\N', '\N'), "\n";
1017      }      }
1018    
1019      close($q_fh);      close($q_fh);
# Line 1026  Line 1025 
1025      $self->db_handle->load_table(tbl => 'sim_queue',      $self->db_handle->load_table(tbl => 'sim_queue',
1026                                   file => $tmpfile);                                   file => $tmpfile);
1027    
1028      unlink($tmpfile);  #    unlink($tmpfile);
1029    
1030  #     for my $seek (@seeks)  #     for my $seek (@seeks)
1031  #     {  #     {
# Line 1074  Line 1073 
1073    
1074      my $work = $db->SQL(qq(SELECT qid, chunk_id, seek, len      my $work = $db->SQL(qq(SELECT qid, chunk_id, seek, len
1075                             FROM sim_queue                             FROM sim_queue
1076                             WHERE not finished                             WHERE not finished AND not assigned
1077                             LIMIT 1));                             LIMIT 1));
1078      print "Got work ", Dumper($work), "\n";      print "Got work ", Dumper($work), "\n";
1079    
# Line 1093  Line 1092 
1092      my $fasta;      my $fasta;
1093      read($fh, $fasta, $len);      read($fh, $fasta, $len);
1094    
1095        $db->SQL(qq(UPDATE sim_queue
1096                    SET assigned = true
1097                    WHERE qid = ? AND chunk_id = ?), undef,
1098                 $cpool_id, $chunk_id);
1099    
1100      return($cpool_id, $chunk_id, $nr, $fasta, "$cpool_dir/out.$chunk_id");      return($cpool_id, $chunk_id, $nr, $fasta, "$cpool_dir/out.$chunk_id");
1101  }  }
1102    
1103    sub sim_work_working
1104    {
1105        my($self, $pool, $chunk, $host, $pid) = @_;
1106    
1107        my $db = $self->db_handle();
1108        my $lock = FIG::SimLock->new;
1109    
1110        my $res = $db->SQL(qq(UPDATE sim_queue
1111                              SET worker_pid = ?, start_time = NOW(), worker_info = ?
1112                              WHERE qid = ? AND chunk_id = ?),
1113                           undef,
1114                           $pid, $host, $pool, $chunk);
1115    }
1116    
1117  =head3 sim_work_done  =head3 sim_work_done
1118    
1119  C<< $fig->sim_work_done($pool_id, $chunk_id, $out_file); >>  C<< $fig->sim_work_done($pool_id, $chunk_id, $out_file); >>
# Line 13743  Line 13761 
13761      if ( ( $type eq "peg" ) and $translation )      if ( ( $type eq "peg" ) and $translation )
13762      {      {
13763          $self->add_translation( $fid, $translation );          $self->add_translation( $fid, $translation );
13764            $self->enqueue_similarities([$fid]);
13765      }      }
13766    
13767      my $rv = $dbh->SQL("INSERT INTO features (id,idN,type,genome,location,contig,minloc,maxloc,aliases)      my $rv = $dbh->SQL("INSERT INTO features (id,idN,type,genome,location,contig,minloc,maxloc,aliases)
# Line 13780  Line 13799 
13799      };      };
13800      if ($@)      if ($@)
13801      {      {
13802          return "ERROR $@\n";          warn "Error on proxy call: $@\n";
13803            return undef;
13804      }      }
13805      if ($resp->fault)      if ($resp->fault)
13806      {      {

Legend:
Removed from v.1.429  
changed lines
  Added in v.1.430

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3