Changeset 1602

Show
Ignore:
Timestamp:
06/05/08 13:26:51 (3 months ago)
Author:
mbriggs
Message:

Create DroneJob Schema/Framework

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • hive/trunk/data_webapp/app/controllers/hc_database_controller.rb

    r1595 r1602  
    2929  def dequeue_url(url) 
    3030    q = QueueUrl.find(:first,:conditions => {:url => url}) 
     31    jobs = q.drone_jobs 
    3132    if not q.nil? 
    3233      q.destroy 
    3334    end 
     35    return jobs 
    3436  end 
    3537 
     
    117119          bee_work["urls"] << url_obj 
    118120           
    119           if insert(HistoryUrl,url_obj) 
    120             count += 1 
     121          count += 1 if hu = insert(HistoryUrl,url_obj) 
     122 
     123          jobs = dequeue_url(u) 
     124          if not hu.nil? 
     125            jobs.each do |job| 
     126              job.completed_urls << CompletedUrl.new(:history_url => hu) 
     127              job.save 
     128            end 
    121129          end 
    122           dequeue_url(u) 
    123130        end 
    124          
    125         
    126131      end 
    127132    end 
  • hive/trunk/data_webapp/app/models/history_url.rb

    r1111 r1602  
    11class HistoryUrl < ActiveRecord::Base 
    22  belongs_to :client 
     3  # Many-Many DroneJob/HistoryUrl relationships 
     4  has_many :completed_urls, :dependent => :destroy 
     5  has_many :drone_jobs, :through => :completed_urls 
    36   
    47  validates_presence_of :url 
  • hive/trunk/data_webapp/app/models/queue_url.rb

    r1589 r1602  
    11require 'resolv' 
    22class QueueUrl < ActiveRecord::Base 
     3  # Many-Many DroneJob/QueueUrl relationships 
     4  has_many :pending_urls, :dependent => :destroy 
     5  has_many :drone_jobs, :through => :pending_urls 
    36 
    47  # These validations will only work on basic ActiveRecord::Base save and update 
  • hive/trunk/data_webapp/app/models/user.rb

    r1185 r1602  
    22class User < ActiveRecord::Base 
    33  has_one :heartbeat, :dependent => :destroy 
     4  #TODO: Associate JobSources to the authenticated User creating the DroneJob? 
     5  # has_many :job_source 
    46   
    57  # Virtual attribute for the unencrypted password