From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 40DEAE00BC2; Mon, 21 Dec 2015 05:13:18 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-HAM-Report: * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider * (sujith.h[at]gmail.com) * -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low * trust * [209.85.220.174 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 0.0 HTML_MESSAGE BODY: HTML included in message * -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's * domain * 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily * valid * -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Received: from mail-qk0-f174.google.com (mail-qk0-f174.google.com [209.85.220.174]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id A3420E00863 for ; Mon, 21 Dec 2015 05:13:16 -0800 (PST) Received: by mail-qk0-f174.google.com with SMTP id p187so136598538qkd.1 for ; Mon, 21 Dec 2015 05:13:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=gzxhYcC4yln5gc472353Bv/QnkShfY79GaKjWE4xeh4=; b=ZTObLIMqC3uUGRT/T5dGWIzj9QwFhVCjPtHWYn9LIczQFrTiSdWdaX/ljamFO2xMBT aJEWlS9sRPemyBNASMKL+dTA3tXwDQ/ihE7SmkrV1XuB0iMdqOp6S0amNjmazj++kyJc TSOZh2B4ZhqTo4Nad0E/lHUXNmMQNGRs+xue0TJQL0Hgf1JQVyZX7x/WrINJbGyWMKE/ E9Ymt7g47BrXehLAFQXKca6E7DE8/v9ZXLKPmqA3Dk0LFICIMy9H3Fl2HCKNXeFrx9l/ ZMrI2m+rLOKNS0KJe4VAkPlg8jTN8EosqF/XSLeHhGNaoiffFtg8gmanm1VzPSvscExm C7wA== X-Received: by 10.55.81.132 with SMTP id f126mr24199896qkb.88.1450703595551; Mon, 21 Dec 2015 05:13:15 -0800 (PST) MIME-Version: 1.0 Received: by 10.55.154.70 with HTTP; Mon, 21 Dec 2015 05:12:56 -0800 (PST) In-Reply-To: References: <20151218134627.GA27311@linux.intel.com> From: sujith h Date: Mon, 21 Dec 2015 18:42:56 +0530 Message-ID: To: toaster@yoctoproject.org Subject: Re: Build cancellation from toaster X-BeenThere: toaster@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Web based interface for BitBake List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2015 13:13:18 -0000 Content-Type: multipart/alternative; boundary=001a114a847c7cc3270527684057 --001a114a847c7cc3270527684057 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi, I have updated patch : http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/log/?h=3Dsujith/toas= ter-build-cancel2 Let me know if this looks ok or needs more enhancement(s)? Thanks, Sujith H On Mon, Dec 21, 2015 at 1:37 PM, sujith h wrote: > Hi, > > > On Sat, Dec 19, 2015 at 8:57 PM, sujith h wrote: > >> Hi, >> >> On Fri, Dec 18, 2015 at 7:16 PM, Ed Bartosh >> wrote: >> >>> Hi Sujith, >>> >>> Can you split your changes please? >>> I'd suggest to at least separate backend changes from frontend ones. >>> >>> Having uihelper.py changes in a separate commit would be nice too. >>> It looks like you've spotted correctly that findServerDetails is not >>> used anywhere in bitbake code. You can remove it in a separate commit a= s >>> it looks unrelated to the rest of the patch. >>> >>> +1 for Michael's suggestion to use build controller. >>> >> >> The problem I see using build controller is: >> >> I have tried with the build controller approach earlier and below are my >> findings: >> Lets say if I try to use getBuildEnvironmentController function as: >> >> localhostbctrl =3D localhostbecontroller.LocalhostBEController(be) # in >> toastergui/views.py >> localhostbctrl.getBBController() >> >> Then the failure starts when the control reaches function startBBServer >> and the initial assert fails. >> >> Even if I try to add a wrapper function known as cancelBuild in >> bbcontroller.py: >> >> def conncetToServer(self): >> server =3D bb.server.xmlrpc.BitBakeXMLRPCClient() >> server.initServer() >> server.saveConnectionDetails("%s:%s" % (self.be.bbaddress, >> self.be.bbport)) >> self.connection =3D server.establishConnection([]) >> >> self.be.bbtoken =3D self.connection.transport.connection_token >> self.be.save() >> >> return BitbakeController(self.connection) >> >> This would fail in server.establishConnection line. Because internally i= t >> does call connect function in xmlrpc.py which does call >> uievent.BBUIEventQueue. This call causes exception, because in >> registerEventHandler function there is a line: >> >> if (self.cooker.state in [bb.cooker.state.parsing, >> bb.cooker.state.running]): >> >> I couldn't tackle this situation and that is the reason why I opted for >> another approach from uihelper's function findServerDetails. >> Is there any other way using which I can tackle this situation from >> bbcontroller.py? As per my investigation the problem bubbles around with >> registerEventHandler function with this approach. >> > > Another approach which I followed was ( using bbcontroller.py ) by writin= g > a new function getBBServer: > > def getBBServer(self, host, port): > """ returns a connection from running server. This helps in > cancellation of bitbake from > toaster UI. > """ > server, transport =3D bb.server.xmlrpc._create_server(host, port) > return server > > And then call this function from toastergui/views.py file: > > br =3D > BuildRequest.objects.select_for_update().get(project =3D prj, pk =3D i, > state__lte =3D BuildRequest.REQ_INPROGRESS) > bbctrl =3D > bbcontroller.BuildEnvironmentController(br.environment) > server =3D > bbctrl.getBBServer(br.environment.bbaddress, br.environment.bbport) > logger.warning(br.environment.LOCK_STATE) > server.runCommand(["stateForceShutdown"]) > while True: > if len(BuildRequest.objects.get(pk =3D i > ).build.errors) > 0: > br.state =3D BuildRequest.REQ_DELETED > br.save() > build =3D BuildRequest.objects.get(pk =3D= i > ).build > build.outcome =3D 0 > build.save() > break > > > Nothing else is coming into my mind. Any pointers? > >> >> Thanks, >> Sujith H >> >> >>> On Thu, Dec 17, 2015 at 10:26:11PM +0530, sujith h wrote: >>> > Hi, >>> > >>> > I have posted my changes in: >>> > >>> http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/log/?h=3Dsujith/= toaster-build-cancel >>> > >>> > Kindly review my changes and let me know if I have to make changes. I >>> would >>> > be happy to do so. >>> > >>> > Thanks for all helping hand from RP, Ed, Michael, Belen and Paul. >>> > >>> > Thanks, >>> > Sujith H >>> >>> -- >>> Regards, >>> Ed >>> >> >> >> >> -- >> =E0=B4=B8=E0=B5=81=E0=B4=9C=E0=B4=BF=E0=B4=A4=E0=B5=8D =E0=B4=B9=E0=B4= =B0=E0=B4=BF=E0=B4=A6=E0=B4=BE=E0=B4=B8=E0=B4=A8=E0=B5=8D >> Bangalore >> Contributor to KDE project >> http://fci.wikia.com/wiki/Anti-DRM-Campaign >> http://sujithh.info >> > > > > -- > =E0=B4=B8=E0=B5=81=E0=B4=9C=E0=B4=BF=E0=B4=A4=E0=B5=8D =E0=B4=B9=E0=B4=B0= =E0=B4=BF=E0=B4=A6=E0=B4=BE=E0=B4=B8=E0=B4=A8=E0=B5=8D > Bangalore > Contributor to KDE project > http://fci.wikia.com/wiki/Anti-DRM-Campaign > http://sujithh.info > --=20 =E0=B4=B8=E0=B5=81=E0=B4=9C=E0=B4=BF=E0=B4=A4=E0=B5=8D =E0=B4=B9=E0=B4=B0= =E0=B4=BF=E0=B4=A6=E0=B4=BE=E0=B4=B8=E0=B4=A8=E0=B5=8D Bangalore Contributor to KDE project http://fci.wikia.com/wiki/Anti-DRM-Campaign http://sujithh.info --001a114a847c7cc3270527684057 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Let me = know if this looks ok or needs more enhancement(s)?

Thanks,
Sujith H

On Mon, Dec 21, 2015 at 1:37 PM, sujith h <sujith.h@gmail.com= > wrote:
= Hi,


=
On Sat, Dec 19, 2015 at 8:57 PM, sujith h <sujith= .h@gmail.com> wrote:
Hi,

On Fri, Dec 18, 2015 at 7:16 PM, Ed Bartosh = <ed.bartosh@linux.intel.com> wrote:
Hi Sujith,

Can you split your changes please?
I'd suggest to at least separate backend changes from frontend ones.
Having uihelper.py changes in a separate commit would be nice too.
It looks like you've spotted correctly that findServerDetails is not used anywhere in bitbake code. You can remove it in a separate commit as it looks unrelated to the rest of the patch.

+1 for Michael's suggestion to use build controller.

=C2=A0The problem I see using build controller is:=

I have tried with the build controller approach earlier = and below are my findings:
Lets say if I try to use getBuildE= nvironmentController function as:

localhostbctrl =3D loca= lhostbecontroller.LocalhostBEController(be) # in toastergui/views.py
localhostbctrl.getBBController()

Then the failure= starts when the control reaches function startBBServer=C2=A0 and the initi= al assert fails.

Even if I try to add a wrapper function = known as cancelBuild in bbcontroller.py:

=C2=A0=C2=A0=C2=A0 def conn= cetToServer(self):
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 server =3D= bb.server.xmlrpc.BitBakeXMLRPCClient()
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 server.initServer()
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 server.saveConnectionDetails("%s:%s" % (self.be.bbaddress, se= lf.be.bbport))
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 self.connectio= n =3D server.establishConnection([])

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 self.be.bbtoken =3D self.connection.transport.connection_token=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 self.be.save()

=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return BitbakeController(self.connecti= on)

This would fail in server.establishConnection line. B= ecause internally it does call connect function in xmlrpc.py which does cal= l uievent.BBUIEventQueue. This call causes exception, because in registerEv= entHandler function=C2=A0 there is a line:

=C2=A0if (self.cooker.sta= te in [bb.cooker.state.parsing, bb.cooker.state.running]):

I couldn't tackle this situation and that is the reason why I opted f= or another approach from uihelper's function findServerDetails.
Is there any other way using which I can tackle this situation from = bbcontroller.py? As per my investigation the problem bubbles around with re= gisterEventHandler function with this approach.
=

Another approach which I= followed was ( using bbcontroller.py ) by writing a new function getBBServ= er:

=C2=A0=C2=A0=C2=A0 def getBBServer(self, host, port):
=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 """ returns a connectio= n from running server. This helps in cancellation of bitbake from
=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 toaster UI.=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 """
=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 server, transport =3D bb.server.xmlrpc._c= reate_server(host, port)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 retu= rn server

And then call this function from toastergui/vie= ws.py file:

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 br =3D BuildRequest.objects.select_for_update().get(project =3D p= rj, pk =3D i, state__lte =3D BuildRequest.REQ_INPROGRESS)
=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 bbctrl =3D bbcontroller= .BuildEnvironmentController(br.environment)
=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 server =3D bbctrl.getBBServer(br.envir= onment.bbaddress, br.environment.bbport)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 logger.warning(br.environment.LOCK_STATE)=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 serve= r.runCommand(["stateForceShutdown"])
=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 while True:
=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if le= n(BuildRequest.objects.get(pk =3D i ).build.errors) > 0:
=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 br.state =3D BuildRequest.REQ_DELETED
=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 br.save()
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 build =3D BuildRequest.objects.get(pk =3D i ).build
=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 build.outcome =3D 0
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 build.save()
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break

<= /div>

Nothing else is coming into my mind. Any pointers?=

Thanks,
Sujith H


On Thu, Dec 17, 2015 at 10:26:11PM +0530, sujith h wrote:
> Hi,
>
> I have posted my changes in:
> http= ://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/log/?h=3Dsujith/toaster-= build-cancel
>
> Kindly review my changes and let me know if I have to make changes. I = would
> be happy to do so.
>
> Thanks for all helping hand from RP, Ed, Michael, Belen and Paul.
>
> Thanks,
> Sujith H

--
Regards,
Ed



--
=E0= =B4=B8=E0=B5=81=E0=B4=9C=E0=B4=BF=E0=B4=A4=E0=B5=8D =E0=B4=B9=E0=B4=B0=E0= =B4=BF=E0=B4=A6=E0=B4=BE=E0=B4=B8=E0=B4=A8=E0=B5=8D
Bangalore
<Pro= ject>Contributor to KDE project
http://fci.wikia.com/wiki/Anti-DRM-Cam= paign
<Blog> http://sujithh.info



--
=E0=B4=B8=E0=B5=81=E0=B4=9C=E0=B4=BF=E0=B4=A4=E0=B5=8D =E0= =B4=B9=E0=B4=B0=E0=B4=BF=E0=B4=A6=E0=B4=BE=E0=B4=B8=E0=B4=A8=E0=B5=8D
Ba= ngalore
<Project>Contributor to KDE project
http://fci.wikia.com= /wiki/Anti-DRM-Campaign
<Blog> http://sujithh.info



--
=E0=B4=B8=E0=B5=81=E0=B4=9C=E0=B4=BF=E0=B4=A4=E0=B5=8D =E0=B4=B9=E0= =B4=B0=E0=B4=BF=E0=B4=A6=E0=B4=BE=E0=B4=B8=E0=B4=A8=E0=B5=8D
Bangalore<Project>Contributor to KDE project
http://fci.wikia.com/wiki/Ant= i-DRM-Campaign
<Blog> http://sujithh.info
--001a114a847c7cc3270527684057--