Skip to contentSkip to conversation

toaster: Read correct cooker log path from toasterui

PATCH In review Elliot Smith 2 participants 4 messages Sep 10, 2015 – Sep 12, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 toaster: Read correct cooker log path from toasterui

The BB_CONSOLELOG variable changes by the time we read it in BuildInfoHelper. This means that the log file location we are using is incorrect, so the links to the cooker logs don't work.

Instead, read it at the point when the BuildStarted event occurs in toasterui. The BB_CONSOLELOG variable has the correct value here, so pass that to BuildInfoHelper.

[YOCTO #8209]

---
 bitbake/lib/bb/ui/buildinfohelper.py | 8 ++++----
 bitbake/lib/bb/ui/toasterui.py       | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)
bitbake/lib/bb/ui/buildinfohelper.py +4 -4
index 2d1ed51..6e313fe 100644
@@ -704,7 +704,7 @@ class BuildInfoHelper(object):
     ## methods to convert event/external info into objects that the ORM layer uses
 
 
-    def _get_build_information(self):
+    def _get_build_information(self, consolelogfile):
         build_info = {}
         # Generate an identifier for each new build
 
@@ -713,7 +713,7 @@ class BuildInfoHelper(object):
         build_info['distro_version'] = self.server.runCommand(["getVariable", "DISTRO_VERSION"])[0]
         build_info['started_on'] = timezone.now()
         build_info['completed_on'] = timezone.now()
-        build_info['cooker_log_path'] = self.server.runCommand(["getVariable", "BB_CONSOLELOG"])[0]
+        build_info['cooker_log_path'] = consolelogfile
         build_info['build_name'] = self.server.runCommand(["getVariable", "BUILDNAME"])[0]
         build_info['bitbake_version'] = self.server.runCommand(["getVariable", "BB_VERSION"])[0]
 
@@ -847,9 +847,9 @@ class BuildInfoHelper(object):
                 logger.warn("buildinfohelper: cannot identify layer exception:%s ", nee)
 
 
-    def store_started_build(self, event):
+    def store_started_build(self, event, consolelogfile):
         assert '_pkgs' in vars(event)
-        build_information = self._get_build_information()
+        build_information = self._get_build_information(consolelogfile)
 
         build_obj = self.orm_wrapper.create_build_object(build_information, self.brbe, self.project)
 
bitbake/lib/bb/ui/toasterui.py +1 -1
index 9c7e87d..e0c278b 100644
@@ -126,7 +126,7 @@ def main(server, eventHandler, params ):
             # the code will look into the protected variables of the event; no easy way around this
 
             if isinstance(event, bb.event.BuildStarted):
-                buildinfohelper.store_started_build(event)
+                buildinfohelper.store_started_build(event, consolelogfile)
 
             if isinstance(event, (bb.build.TaskStarted, bb.build.TaskSucceeded, bb.build.TaskFailedSilent)):
                 buildinfohelper.update_and_store_task(event)
Signature · 14 lines
Elliot Smith
Software Engineer
Intel OTC

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#1 lore raw

Hi,

This fixed it for the managed build case but it failed for the analysis mode case :(

Environment:

Request Method: GET
Request URL: http://192.168.168.66:8000/toastergui/build/1/artifact/cookerlog/id/1

Django Version: 1.6
Python Version: 2.7.6
Installed Applications:
('django.contrib.auth',
'django.contrib.contenttypes', 'django.contrib.messages', 'django.contrib.sessions', 'django.contrib.admin', 'django.contrib.staticfiles', 'django.contrib.humanize',
'bldcollector',
'toastermain',
'south',
'toastergui',
'bldcontrol',
'orm')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware')

Traceback:
File "/big/src/intel/yocto-builds/TOASTER/myBugs/t-myBugs/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
114. response = wrapped_callback(request,
*callback_args, **callback_kwargs)
File "/big/src/intel/myBugs/poky/bitbake/lib/toaster/toastergui/views.py"
in build_artifact
2745. build_artifact_storage_dir =
os.path.join(ToasterSetting.objects.get(name="ARTIFACTS_STORAGE_DIR").value,
"%d" % int(build_id))
File "/big/src/intel/yocto-builds/TOASTER/myBugs/t-myBugs/local/lib/python2.7/site-packages/django/db/models/manager.py" in get
151. return self.get_queryset().get(*args, **kwargs)
File "/big/src/intel/yocto-builds/TOASTER/myBugs/t-myBugs/local/lib/python2.7/site-packages/django/db/models/query.py" in get
307. self.model._meta.object_name)

Exception Type: DoesNotExist at /toastergui/build/1/artifact/cookerlog/id/1 Exception Value: ToasterSetting matching query does not exist.

-b

Quoted 85 lines · Elliot Smith

The BB_CONSOLELOG variable changes by the time we read it in BuildInfoHelper. This means that the log file location we are using is incorrect, so the links to the cooker logs don't work.

Instead, read it at the point when the BuildStarted event occurs in toasterui. The BB_CONSOLELOG variable has the correct value here, so pass that to BuildInfoHelper.

[YOCTO #8209]

---
 bitbake/lib/bb/ui/buildinfohelper.py | 8 ++++----
 bitbake/lib/bb/ui/toasterui.py       | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)
bitbake/lib/bb/ui/buildinfohelper.py +4 -4
index 2d1ed51..6e313fe 100644
@@ -704,7 +704,7 @@ class BuildInfoHelper(object):
     ## methods to convert event/external info into objects that the ORM layer uses
 
 
-    def _get_build_information(self):
+    def _get_build_information(self, consolelogfile):
         build_info = {}
         # Generate an identifier for each new build
 
@@ -713,7 +713,7 @@ class BuildInfoHelper(object):
         build_info['distro_version'] = self.server.runCommand(["getVariable", "DISTRO_VERSION"])[0]
         build_info['started_on'] = timezone.now()
         build_info['completed_on'] = timezone.now()
-        build_info['cooker_log_path'] = self.server.runCommand(["getVariable", "BB_CONSOLELOG"])[0]
+        build_info['cooker_log_path'] = consolelogfile
         build_info['build_name'] = self.server.runCommand(["getVariable", "BUILDNAME"])[0]
         build_info['bitbake_version'] = self.server.runCommand(["getVariable", "BB_VERSION"])[0]
 
@@ -847,9 +847,9 @@ class BuildInfoHelper(object):
                 logger.warn("buildinfohelper: cannot identify layer exception:%s ", nee)
 
 
-    def store_started_build(self, event):
+    def store_started_build(self, event, consolelogfile):
         assert '_pkgs' in vars(event)
-        build_information = self._get_build_information()
+        build_information = self._get_build_information(consolelogfile)
 
         build_obj = self.orm_wrapper.create_build_object(build_information, self.brbe, self.project)
 
bitbake/lib/bb/ui/toasterui.py +1 -2
index 9c7e87d..e0c278b 100644
@@ -126,7 +126,7 @@ def main(server, eventHandler, params ):
             # the code will look into the protected variables of the event; no easy way around this
 
             if isinstance(event, bb.event.BuildStarted):
-                buildinfohelper.store_started_build(event)
+                buildinfohelper.store_started_build(event, consolelogfile)
 
             if isinstance(event, (bb.build.TaskStarted, bb.build.TaskSucceeded, bb.build.TaskFailedSilent)):
                 buildinfohelper.update_and_store_task(event)
--

Elliot Smith
Software Engineer
Intel OTC

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.

--
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster

#2 lore raw

the new branch worked for me (both ways) and is nicely simpler. submitted upstream.
-b

Quoted 144 lines · Brian Avery

Hi,

This fixed it for the managed build case but it failed for the analysis mode case :(

Environment:

Request Method: GET
Request URL: http://192.168.168.66:8000/toastergui/build/1/artifact/cookerlog/id/1

Django Version: 1.6
Python Version: 2.7.6
Installed Applications:
('django.contrib.auth',
'django.contrib.contenttypes', 'django.contrib.messages', 'django.contrib.sessions', 'django.contrib.admin', 'django.contrib.staticfiles', 'django.contrib.humanize',
'bldcollector',
'toastermain',
'south',
'toastergui',
'bldcontrol',
'orm')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware')

Traceback:
File "/big/src/intel/yocto-builds/TOASTER/myBugs/t-myBugs/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
114. response = wrapped_callback(request,
*callback_args, **callback_kwargs)
File "/big/src/intel/myBugs/poky/bitbake/lib/toaster/toastergui/views.py"
in build_artifact
2745. build_artifact_storage_dir =
os.path.join(ToasterSetting.objects.get(name="ARTIFACTS_STORAGE_DIR").value,
"%d" % int(build_id))
File "/big/src/intel/yocto-builds/TOASTER/myBugs/t-myBugs/local/lib/python2.7/site-packages/django/db/models/manager.py" in get
151. return self.get_queryset().get(*args, **kwargs)
File "/big/src/intel/yocto-builds/TOASTER/myBugs/t-myBugs/local/lib/python2.7/site-packages/django/db/models/query.py" in get
307. self.model._meta.object_name)

Exception Type: DoesNotExist at /toastergui/build/1/artifact/cookerlog/id/1 Exception Value: ToasterSetting matching query does not exist.

-b

Quoted 85 lines · Elliot Smith

The BB_CONSOLELOG variable changes by the time we read it in BuildInfoHelper. This means that the log file location we are using is incorrect, so the links to the cooker logs don't work.

Instead, read it at the point when the BuildStarted event occurs in toasterui. The BB_CONSOLELOG variable has the correct value here, so pass that to BuildInfoHelper.

[YOCTO #8209]

---
 bitbake/lib/bb/ui/buildinfohelper.py | 8 ++++----
 bitbake/lib/bb/ui/toasterui.py       | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)
bitbake/lib/bb/ui/buildinfohelper.py +4 -4
index 2d1ed51..6e313fe 100644
@@ -704,7 +704,7 @@ class BuildInfoHelper(object):
     ## methods to convert event/external info into objects that the ORM layer uses
 
 
-    def _get_build_information(self):
+    def _get_build_information(self, consolelogfile):
         build_info = {}
         # Generate an identifier for each new build
 
@@ -713,7 +713,7 @@ class BuildInfoHelper(object):
         build_info['distro_version'] = self.server.runCommand(["getVariable", "DISTRO_VERSION"])[0]
         build_info['started_on'] = timezone.now()
         build_info['completed_on'] = timezone.now()
-        build_info['cooker_log_path'] = self.server.runCommand(["getVariable", "BB_CONSOLELOG"])[0]
+        build_info['cooker_log_path'] = consolelogfile
         build_info['build_name'] = self.server.runCommand(["getVariable", "BUILDNAME"])[0]
         build_info['bitbake_version'] = self.server.runCommand(["getVariable", "BB_VERSION"])[0]
 
@@ -847,9 +847,9 @@ class BuildInfoHelper(object):
                 logger.warn("buildinfohelper: cannot identify layer exception:%s ", nee)
 
 
-    def store_started_build(self, event):
+    def store_started_build(self, event, consolelogfile):
         assert '_pkgs' in vars(event)
-        build_information = self._get_build_information()
+        build_information = self._get_build_information(consolelogfile)
 
         build_obj = self.orm_wrapper.create_build_object(build_information, self.brbe, self.project)
 
bitbake/lib/bb/ui/toasterui.py +1 -2
index 9c7e87d..e0c278b 100644
@@ -126,7 +126,7 @@ def main(server, eventHandler, params ):
             # the code will look into the protected variables of the event; no easy way around this
 
             if isinstance(event, bb.event.BuildStarted):
-                buildinfohelper.store_started_build(event)
+                buildinfohelper.store_started_build(event, consolelogfile)
 
             if isinstance(event, (bb.build.TaskStarted, bb.build.TaskSucceeded, bb.build.TaskFailedSilent)):
                 buildinfohelper.update_and_store_task(event)
--

Elliot Smith
Software Engineer
Intel OTC

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.

--
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster

#3 lore raw

Thanks Brian.

Elliot

Quoted 171 lines · Brian Avery

the new branch worked for me (both ways) and is nicely simpler. submitted upstream.
-b

Quoted 10 lines · Brian Avery

Hi,

This fixed it for the managed build case but it failed for the analysis mode case :(

Environment:

Request Method: GET
Request URL:

http://192.168.168.66:8000/toastergui/build/1/artifact/cookerlog/id/1

Quoted 25 lines

Django Version: 1.6
Python Version: 2.7.6
Installed Applications:
('django.contrib.auth',
'django.contrib.contenttypes', 'django.contrib.messages', 'django.contrib.sessions', 'django.contrib.admin', 'django.contrib.staticfiles', 'django.contrib.humanize',
'bldcollector',
'toastermain',
'south',
'toastergui',
'bldcontrol',
'orm')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware')

Quoted 2 lines

Traceback:
File

"/big/src/intel/yocto-builds/TOASTER/myBugs/t-myBugs/local/lib/python2.7/site-packages/django/core/handlers/base.py"

Quoted 7 lines

in get_response
114. response = wrapped_callback(request,
*callback_args, **callback_kwargs)
File "/big/src/intel/myBugs/poky/bitbake/lib/toaster/toastergui/views.py" in build_artifact
2745. build_artifact_storage_dir =

os.path.join(ToasterSetting.objects.get(name="ARTIFACTS_STORAGE_DIR").value,

Quoted 2 lines

"%d" % int(build_id))
File

"/big/src/intel/yocto-builds/TOASTER/myBugs/t-myBugs/local/lib/python2.7/site-packages/django/db/models/manager.py"

Quoted 3 lines

in get
151. return self.get_queryset().get(*args, **kwargs)
File

"/big/src/intel/yocto-builds/TOASTER/myBugs/t-myBugs/local/lib/python2.7/site-packages/django/db/models/query.py"

Quoted 4 lines

in get
307. self.model._meta.object_name)

Exception Type: DoesNotExist at

/toastergui/build/1/artifact/cookerlog/id/1

Quoted 6 lines

Exception Value: ToasterSetting matching query does not exist.

-b

On Thu, Sep 10, 2015 at 3:50 AM, Elliot Smith <[email protected]>

Quoted 11 lines · wrote:
Quoted 11 lines

The BB_CONSOLELOG variable changes by the time we read it in BuildInfoHelper. This means that the log file location we are using is incorrect, so the links to the cooker logs don't work.

Instead, read it at the point when the BuildStarted event occurs in toasterui. The BB_CONSOLELOG variable has the correct value here, so pass that to BuildInfoHelper.

[YOCTO #8209]

Quoted 7 lines

Review

Quoted 7 lines
---
 bitbake/lib/bb/ui/buildinfohelper.py | 8 ++++----
 bitbake/lib/bb/ui/toasterui.py       | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)
(quoted diff) +0 -0

b/bitbake/lib/bb/ui/buildinfohelper.py

Quoted 5 lines

bitbake/lib/bb/ui/buildinfohelper.py class BuildInfoHelper(object): · line 704

Quoted 5 lines

index 2d1ed51..6e313fe 100644

bitbake/lib/bb/ui/buildinfohelper.py +0 -0
@@ -704,7 +704,7 @@ class BuildInfoHelper(object):
     ## methods to convert event/external info into objects that the

ORM layer uses

Quoted 9 lines

bitbake/lib/bb/ui/buildinfohelper.py class BuildInfoHelper(object): · line 713

Quoted 9 lines
bitbake/lib/bb/ui/buildinfohelper.py +1 -1
-    def _get_build_information(self):
+    def _get_build_information(self, consolelogfile):
         build_info = {}
         # Generate an identifier for each new build
 
@@ -713,7 +713,7 @@ class BuildInfoHelper(object):
         build_info['distro_version'] =

self.server.runCommand(["getVariable", "DISTRO_VERSION"])[0]

Quoted 3 lines

bitbake/lib/bb/ui/buildinfohelper.py class BuildInfoHelper(object):

Quoted 3 lines
bitbake/lib/bb/ui/buildinfohelper.py +0 -1
         build_info['started_on'] = timezone.now()
         build_info['completed_on'] = timezone.now()
-        build_info['cooker_log_path'] =

self.server.runCommand(["getVariable", "BB_CONSOLELOG"])[0]

Quoted 2 lines

bitbake/lib/bb/ui/buildinfohelper.py class BuildInfoHelper(object): · line 717

Quoted 2 lines
bitbake/lib/bb/ui/buildinfohelper.py +1 -0
+        build_info['cooker_log_path'] = consolelogfile
         build_info['build_name'] =

self.server.runCommand(["getVariable", "BUILDNAME"])[0]

Quoted 1 line

bitbake/lib/bb/ui/buildinfohelper.py class BuildInfoHelper(object): · line 718

Quoted 1 line
bitbake/lib/bb/ui/buildinfohelper.py +0 -0
         build_info['bitbake_version'] =

self.server.runCommand(["getVariable", "BB_VERSION"])[0]

Quoted 3 lines

bitbake/lib/bb/ui/buildinfohelper.py class BuildInfoHelper(object): · line 847

Quoted 3 lines
bitbake/lib/bb/ui/buildinfohelper.py +0 -0
@@ -847,9 +847,9 @@ class BuildInfoHelper(object):
                 logger.warn("buildinfohelper: cannot identify layer

exception:%s ", nee)

Quoted 9 lines

bitbake/lib/bb/ui/buildinfohelper.py class BuildInfoHelper(object):

Quoted 9 lines
bitbake/lib/bb/ui/buildinfohelper.py +2 -2
-    def store_started_build(self, event):
+    def store_started_build(self, event, consolelogfile):
         assert '_pkgs' in vars(event)
-        build_information = self._get_build_information()
+        build_information = self._get_build_information(consolelogfile)
 
         build_obj =

self.orm_wrapper.create_build_object(build_information, self.brbe, self.project)

Quoted 2 lines

Review

Quoted 2 lines
(quoted diff) +0 -0

b/bitbake/lib/bb/ui/toasterui.py

Quoted 5 lines

bitbake/lib/bb/ui/toasterui.py def main(server, eventHandler, params ): · line 126

Quoted 5 lines

index 9c7e87d..e0c278b 100644

bitbake/lib/bb/ui/toasterui.py +0 -0
@@ -126,7 +126,7 @@ def main(server, eventHandler, params ):
             # the code will look into the protected variables of the

event; no easy way around this

Quoted 4 lines

bitbake/lib/bb/ui/toasterui.py def main(server, eventHandler, params ):

Quoted 4 lines
bitbake/lib/bb/ui/toasterui.py +1 -1
             if isinstance(event, bb.event.BuildStarted):
-                buildinfohelper.store_started_build(event)
+                buildinfohelper.store_started_build(event,

consolelogfile)

Quoted 2 lines

bitbake/lib/bb/ui/toasterui.py def main(server, eventHandler, params ): · line 129

Quoted 2 lines
bitbake/lib/bb/ui/toasterui.py +0 -0
             if isinstance(event, (bb.build.TaskStarted,

bb.build.TaskSucceeded, bb.build.TaskFailedSilent)):

Quoted 22 lines
Quoted 22 lines
bitbake/lib/bb/ui/toasterui.py +0 -1
                 buildinfohelper.update_and_store_task(event)
--

Elliot Smith
Software Engineer
Intel OTC

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.

--
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster

Signature · 3 lines
Elliot Smith
Software Engineer
Intel Open Source Technology Centre