diff options
author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2014-02-18 18:41:47 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-03-09 12:23:58 -0700 |
commit | 0daa189028fac906f11b7fbb6bf8ed5444667712 (patch) | |
tree | e53b7f5c4e0eb3a653ef96f4a43889f23819845d /bitbake | |
parent | 1660519e5ceca873aaab0eb3aac6495be5f80dc2 (diff) | |
download | poky-0daa189028fac906f11b7fbb6bf8ed5444667712.tar.gz |
bitbake: toasterui: task data structure in toasterui
We update the structure used to hold interm task data,
before it is written to the database, to lower the changes
of key collision.
This will also lead to a cleaner data structure and easier
inspection.
(Bitbake rev: 49cb9f543526a161bc4c097f94422ea08b491ef9)
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/ui/buildinfohelper.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py index 54f6c4ebe8..160cb03743 100644 --- a/bitbake/lib/bb/ui/buildinfohelper.py +++ b/bitbake/lib/bb/ui/buildinfohelper.py | |||
@@ -308,6 +308,7 @@ class BuildInfoHelper(object): | |||
308 | def __init__(self, server, has_build_history = False): | 308 | def __init__(self, server, has_build_history = False): |
309 | self._configure_django() | 309 | self._configure_django() |
310 | self.internal_state = {} | 310 | self.internal_state = {} |
311 | self.internal_state['taskdata'] = {} | ||
311 | self.task_order = 0 | 312 | self.task_order = 0 |
312 | self.server = server | 313 | self.server = server |
313 | self.orm_wrapper = ORMWrapper() | 314 | self.orm_wrapper = ORMWrapper() |
@@ -444,7 +445,7 @@ class BuildInfoHelper(object): | |||
444 | self.orm_wrapper.update_build_object(self.internal_state['build'], errors, warnings, taskfailures) | 445 | self.orm_wrapper.update_build_object(self.internal_state['build'], errors, warnings, taskfailures) |
445 | 446 | ||
446 | def store_started_task(self, event): | 447 | def store_started_task(self, event): |
447 | identifier = event.taskfile + event.taskname | 448 | identifier = event.taskfile.split(":")[-1] + ":" + event.taskname |
448 | 449 | ||
449 | recipe_information = self._get_recipe_information_from_taskfile(event.taskfile) | 450 | recipe_information = self._get_recipe_information_from_taskfile(event.taskfile) |
450 | recipe = self.orm_wrapper.get_update_recipe_object(recipe_information) | 451 | recipe = self.orm_wrapper.get_update_recipe_object(recipe_information) |
@@ -472,7 +473,7 @@ class BuildInfoHelper(object): | |||
472 | 473 | ||
473 | task_obj = self.orm_wrapper.get_update_task_object(task_information) | 474 | task_obj = self.orm_wrapper.get_update_task_object(task_information) |
474 | 475 | ||
475 | self.internal_state[identifier] = { | 476 | self.internal_state['taskdata'][identifier] = { |
476 | 'start_time': datetime.datetime.now(), | 477 | 'start_time': datetime.datetime.now(), |
477 | 'outcome': task_information['outcome'], | 478 | 'outcome': task_information['outcome'], |
478 | } | 479 | } |
@@ -492,13 +493,15 @@ class BuildInfoHelper(object): | |||
492 | task_obj = self.orm_wrapper.get_update_task_object(task_information) | 493 | task_obj = self.orm_wrapper.get_update_task_object(task_information) |
493 | 494 | ||
494 | def update_and_store_task(self, event): | 495 | def update_and_store_task(self, event): |
495 | identifier = event.taskfile + event.taskname | 496 | identifier = event.taskfile.split(":")[-1] + ":" + event.taskname |
497 | assert identifier in self.internal_state['taskdata'] | ||
498 | |||
496 | recipe_information = self._get_recipe_information_from_taskfile(event.taskfile) | 499 | recipe_information = self._get_recipe_information_from_taskfile(event.taskfile) |
497 | recipe = self.orm_wrapper.get_update_recipe_object(recipe_information) | 500 | recipe = self.orm_wrapper.get_update_recipe_object(recipe_information) |
498 | task_information = self._get_task_information(event,recipe) | 501 | task_information = self._get_task_information(event,recipe) |
499 | 502 | ||
500 | task_information['start_time'] = self.internal_state[identifier]['start_time'] | 503 | task_information['start_time'] = self.internal_state['taskdata'][identifier]['start_time'] |
501 | task_information['outcome'] = self.internal_state[identifier]['outcome'] | 504 | task_information['outcome'] = self.internal_state['taskdata'][identifier]['outcome'] |
502 | 505 | ||
503 | if 'logfile' in vars(event): | 506 | if 'logfile' in vars(event): |
504 | task_information['logfile'] = event.logfile | 507 | task_information['logfile'] = event.logfile |
@@ -516,11 +519,11 @@ class BuildInfoHelper(object): | |||
516 | if task_information['outcome'] == Task.OUTCOME_NA: | 519 | if task_information['outcome'] == Task.OUTCOME_NA: |
517 | if isinstance(event, (bb.runqueue.runQueueTaskCompleted, bb.runqueue.sceneQueueTaskCompleted)): | 520 | if isinstance(event, (bb.runqueue.runQueueTaskCompleted, bb.runqueue.sceneQueueTaskCompleted)): |
518 | task_information['outcome'] = Task.OUTCOME_SUCCESS | 521 | task_information['outcome'] = Task.OUTCOME_SUCCESS |
519 | del self.internal_state[identifier] | 522 | del self.internal_state['taskdata'][identifier] |
520 | 523 | ||
521 | if isinstance(event, (bb.runqueue.runQueueTaskFailed, bb.runqueue.sceneQueueTaskFailed)): | 524 | if isinstance(event, (bb.runqueue.runQueueTaskFailed, bb.runqueue.sceneQueueTaskFailed)): |
522 | task_information['outcome'] = Task.OUTCOME_FAILED | 525 | task_information['outcome'] = Task.OUTCOME_FAILED |
523 | del self.internal_state[identifier] | 526 | del self.internal_state['taskdata'][identifier] |
524 | 527 | ||
525 | self.orm_wrapper.get_update_task_object(task_information) | 528 | self.orm_wrapper.get_update_task_object(task_information) |
526 | 529 | ||