All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex DAMIAN <alexandru.damian@intel.com>
To: bitbake-devel@lists.openembedded.org
Subject: [PATCH 02/10] toaster: properly detect failed server start
Date: Mon, 16 Feb 2015 17:53:18 +0000	[thread overview]
Message-ID: <7f47b67bccff55673a827dbcccc767af4459c933.1424108976.git.alexandru.damian@intel.com> (raw)
In-Reply-To: <2060be8d31baa0cd302aa8dc0b6d179df853ee99.1424108976.git.alexandru.damian@intel.com>
In-Reply-To: <cover.1424108976.git.alexandru.damian@intel.com>

From: Alexandru DAMIAN <alexandru.damian@intel.com>

This patch brings in reading the server log if the server
fails to start. This is the first step in displaying the errors
in a manner that is actionable by the user.

[YOCTO #7285]

Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
---
 lib/toaster/bldcontrol/localhostbecontroller.py         |  5 ++++-
 lib/toaster/bldcontrol/management/commands/runbuilds.py | 12 +++++++++---
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/lib/toaster/bldcontrol/localhostbecontroller.py b/lib/toaster/bldcontrol/localhostbecontroller.py
index 005c464..4814b84 100644
--- a/lib/toaster/bldcontrol/localhostbecontroller.py
+++ b/lib/toaster/bldcontrol/localhostbecontroller.py
@@ -108,7 +108,7 @@ class LocalhostBEController(BuildEnvironmentController):
         logger.debug("localhostbecontroller: running the listener at %s" % own_bitbake)
 
 
-        cmd = "bash -c \"source %s/oe-init-build-env %s && bitbake --read conf/toaster-pre.conf --postread conf/toaster.conf --server-only -t xmlrpc -B 0.0.0.0:0 && DATABASE_URL=%s BBSERVER=0.0.0.0:-1 daemon -d -i -D %s -o toaster_ui.log -- %s --observe-only -u toasterui &\"" % (self.pokydirname, self.be.builddir,
+        cmd = "bash -c \"source %s/oe-init-build-env %s && bitbake --read conf/toaster-pre.conf --postread conf/toaster.conf --server-only -t xmlrpc -B 0.0.0.0:0 >toaster_server.log && DATABASE_URL=%s BBSERVER=0.0.0.0:-1 daemon -d -i -D %s -o toaster_ui.log -- %s --observe-only -u toasterui &\"" % (self.pokydirname, self.be.builddir,
                 self.dburl, self.be.builddir, own_bitbake)
         port = "-1"
         cmdoutput = self._shellcmd(cmd)
@@ -290,6 +290,9 @@ class LocalhostBEController(BuildEnvironmentController):
         self.islayerset = True
         return True
 
+    def readServerLogFile(self):
+        return open(os.path.join(self.be.builddir, "toaster_server.log"), "r").read()
+
     def release(self):
         assert self.be.sourcedir and os.path.exists(self.be.builddir)
         import shutil
diff --git a/lib/toaster/bldcontrol/management/commands/runbuilds.py b/lib/toaster/bldcontrol/management/commands/runbuilds.py
index c4ab87b..3de582c 100644
--- a/lib/toaster/bldcontrol/management/commands/runbuilds.py
+++ b/lib/toaster/bldcontrol/management/commands/runbuilds.py
@@ -78,10 +78,16 @@ class Command(NoArgsCommand):
         except Exception as e:
             logger.error("runbuilds: Error executing shell command %s" % e)
             traceback.print_exc(e)
+            if "[Errno 111] Connection refused" in str(e):
+                # Connection refused, read toaster_server.out
+                errmsg = bec.readServerLogFile()
+            else:
+                errmsg = str(e)
+
             BRError.objects.create(req = br,
-                errtype = str(type(e)),
-                errmsg = str(e),
-                traceback = traceback.format_exc(e))
+                    errtype = str(type(e)),
+                    errmsg = errmsg,
+                    traceback = traceback.format_exc(e))
             br.state = BuildRequest.REQ_FAILED
             br.save()
             bec.be.lock = BuildEnvironment.LOCK_FREE
-- 
1.9.1



  parent reply	other threads:[~2015-02-16 17:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-16 17:53 [PATCH 00/10] Toaster patchset pull request Alex DAMIAN
2015-02-16 17:53 ` [PATCH 01/10] toaster: Use on input event for validation rather than keyup Alex DAMIAN
2015-02-16 17:53 ` Alex DAMIAN [this message]
2015-02-16 17:53 ` [PATCH 03/10] toaster: fix git checkout command Alex DAMIAN
2015-02-16 17:53 ` [PATCH 04/10] toaster: layerdetails use new vcs reference api Alex DAMIAN
2015-02-16 17:53 ` [PATCH 05/10] toaster: Additional fixes for the project variable page Alex DAMIAN
2015-02-16 17:53 ` [PATCH 06/10] toaster: New build button allow arbitrary build targets Alex DAMIAN
2015-02-16 17:53 ` [PATCH 07/10] toaster: Remove Layer source from machines, layers and targets Alex DAMIAN
2015-02-16 17:53 ` [PATCH 08/10] toaster: Remove filtering from layers, machines " Alex DAMIAN
2015-02-16 17:53 ` [PATCH 09/10] toaster: Set the machines page default pagesize to 100 Alex DAMIAN

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7f47b67bccff55673a827dbcccc767af4459c933.1424108976.git.alexandru.damian@intel.com \
    --to=alexandru.damian@intel.com \
    --cc=bitbake-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.