summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py34
1 files changed, 15 insertions, 19 deletions
diff --git a/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py b/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py
index 7df81dc5d1..3421726e84 100644
--- a/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py
+++ b/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py
@@ -18,14 +18,13 @@ import signal
18logger = logging.getLogger("toaster") 18logger = logging.getLogger("toaster")
19 19
20class Command(NoArgsCommand): 20class Command(NoArgsCommand):
21 args = "" 21 args = ""
22 help = "Schedules and executes build requests as possible." 22 help = "Schedules and executes build requests as possible. "\
23 "Does not return (interrupt with Ctrl-C)" 23 "Does not return (interrupt with Ctrl-C)"
24
25 24
26 @transaction.atomic 25 @transaction.atomic
27 def _selectBuildEnvironment(self): 26 def _selectBuildEnvironment(self):
28 bec = getBuildEnvironmentController(lock = BuildEnvironment.LOCK_FREE) 27 bec = getBuildEnvironmentController(lock=BuildEnvironment.LOCK_FREE)
29 bec.be.lock = BuildEnvironment.LOCK_LOCK 28 bec.be.lock = BuildEnvironment.LOCK_LOCK
30 bec.be.save() 29 bec.be.save()
31 return bec 30 return bec
@@ -75,17 +74,15 @@ class Command(NoArgsCommand):
75 else: 74 else:
76 errmsg = str(e) 75 errmsg = str(e)
77 76
78 BRError.objects.create(req = br, 77 BRError.objects.create(req=br, errtype=str(type(e)), errmsg=errmsg,
79 errtype = str(type(e)), 78 traceback=traceback.format_exc())
80 errmsg = errmsg,
81 traceback = traceback.format_exc())
82 br.state = BuildRequest.REQ_FAILED 79 br.state = BuildRequest.REQ_FAILED
83 br.save() 80 br.save()
84 bec.be.lock = BuildEnvironment.LOCK_FREE 81 bec.be.lock = BuildEnvironment.LOCK_FREE
85 bec.be.save() 82 bec.be.save()
86 83
87 def archive(self): 84 def archive(self):
88 for br in BuildRequest.objects.filter(state = BuildRequest.REQ_ARCHIVE): 85 for br in BuildRequest.objects.filter(state=BuildRequest.REQ_ARCHIVE):
89 if br.build == None: 86 if br.build == None:
90 br.state = BuildRequest.REQ_FAILED 87 br.state = BuildRequest.REQ_FAILED
91 else: 88 else:
@@ -102,14 +99,13 @@ class Command(NoArgsCommand):
102 BuildRequest.REQ_COMPLETED, 99 BuildRequest.REQ_COMPLETED,
103 BuildRequest.REQ_CANCELLING]) & 100 BuildRequest.REQ_CANCELLING]) &
104 Q(lock=BuildEnvironment.LOCK_LOCK) & 101 Q(lock=BuildEnvironment.LOCK_LOCK) &
105 Q(updated__lt=timezone.now() - timedelta(seconds = 30)) 102 Q(updated__lt=timezone.now() - timedelta(seconds=30))
106 ).update(lock=BuildEnvironment.LOCK_FREE) 103 ).update(lock=BuildEnvironment.LOCK_FREE)
107 104
108 105
109 # update all Builds that were in progress and failed to start 106 # update all Builds that were in progress and failed to start
110 for br in BuildRequest.objects.filter( 107 for br in BuildRequest.objects.filter(state=BuildRequest.REQ_FAILED,
111 state=BuildRequest.REQ_FAILED, 108 build__outcome=Build.IN_PROGRESS):
112 build__outcome=Build.IN_PROGRESS):
113 # transpose the launch errors in ToasterExceptions 109 # transpose the launch errors in ToasterExceptions
114 br.build.outcome = Build.FAILED 110 br.build.outcome = Build.FAILED
115 for brerror in br.brerror_set.all(): 111 for brerror in br.brerror_set.all():
@@ -126,7 +122,7 @@ class Command(NoArgsCommand):
126 122
127 123
128 # update all BuildRequests without a build created 124 # update all BuildRequests without a build created
129 for br in BuildRequest.objects.filter(build = None): 125 for br in BuildRequest.objects.filter(build=None):
130 br.build = Build.objects.create(project=br.project, 126 br.build = Build.objects.create(project=br.project,
131 completed_on=br.updated, 127 completed_on=br.updated,
132 started_on=br.created) 128 started_on=br.created)
@@ -151,10 +147,10 @@ class Command(NoArgsCommand):
151 147
152 # Make sure the LOCK is removed for builds which have been fully 148 # Make sure the LOCK is removed for builds which have been fully
153 # cancelled 149 # cancelled
154 for br in BuildRequest.objects.filter( 150 for br in BuildRequest.objects.filter(\
155 Q(build__outcome=Build.CANCELLED) & 151 Q(build__outcome=Build.CANCELLED) &
156 Q(state=BuildRequest.REQ_CANCELLING) & 152 Q(state=BuildRequest.REQ_CANCELLING) &
157 ~Q(environment=None)): 153 ~Q(environment=None)):
158 br.environment.lock = BuildEnvironment.LOCK_FREE 154 br.environment.lock = BuildEnvironment.LOCK_FREE
159 br.environment.save() 155 br.environment.save()
160 156