[Title] Fixed to update the status of sub-jobs in multi-job
authordonghee yang <donghee.yang@samsung.com>
Mon, 11 Mar 2013 16:02:00 +0000 (01:02 +0900)
committerdonghee yang <donghee.yang@samsung.com>
Mon, 11 Mar 2013 16:02:00 +0000 (01:02 +0900)
src/build_server/JobManager.rb
src/build_server/MultiBuildJob.rb

index 2e4d2fb37b2c09c700371623121782be3b021824..4dd559ede207bcd8ad453bb871ef9d996037e2ae 100644 (file)
@@ -491,9 +491,6 @@ class JobManager
 
        def commit_job(job)
                result = save_job_status(job)
-               job.sub_jobs.each do |j|
-                       save_job_status(j)
-               end
                return result
        end
 
@@ -501,6 +498,9 @@ class JobManager
                now = @server.db_now
                result = @server.get_db_connection() do |db|
                        job.save(db, now)
+                       job.sub_jobs.each do |j|
+                               j.save(db, now)
+                       end
                end
 
                return result
index f387ccec6544b891decd208eebbb0cd5043793d7..c14b4df4b0eb71abc4cb078cecdba62ea03f8308 100644 (file)
@@ -105,6 +105,7 @@ class MultiBuildJob < CommonJob
                end
 
                # initialize all sub jobs and add them to "internal_jobs"
+               tstatus = @status
                @sub_jobs.each do |job|
                        # initialize job
                        if not job.init or job.status == "ERROR" then
@@ -117,10 +118,17 @@ class MultiBuildJob < CommonJob
                                job.status = "WAITING"
                        else
                                job.status = "ERROR"
-                               @status = "ERROR"
+                               tstatus = "ERROR"
                        end
                end
-               if @status == "ERROR" then
+               if tstatus == "ERROR" then
+                       # Changed the status of initialized sub-jobs if parent is in ERROR status
+                       @sub_jobs.each do |job|
+                               if job.status == "WAITING" then
+                                       job.status = "CANCELED"
+                               end 
+                       end
+                       @status = tstatus
                        return false
                end