On Wed, Jan 6, 2016 at 7:08 PM, sujith h wrote: > > > On Tue, Jan 5, 2016 at 7:43 PM, sujith h wrote: > >> >> >> On Tue, Jan 5, 2016 at 7:14 PM, Barros Pena, Belen < >> belen.barros.pena@intel.com> wrote: >> >>> >>> >>> On 04/01/2016 13:16, "toaster-bounces@yoctoproject.org on behalf of >>> sujith >>> h" >>> wrote: >>> >>> >Hi, >>> > >>> > >>> >Finally I arrived at : >>> > >>> http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/log/?h=sujith/toast >>> >er-build-cancel9 >>> >< >>> http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/log/?h=sujith/toas >>> >ter-build-cancel9> >>> >>> I am not sure this is working for me. When I click the 'cancel' button, I >>> get the loading spinner. The spinner never goes away and the build status >>> never updates by itself. If you reload the page after a while though, the >>> build shows as failed. >>> >> >> One thing I missed out is that, I track toaster_ui.log file. So when the >> build progresses there >> I click the cancel button. Before that I haven't tried to cancel the >> build. >> >>> >>> I guess step one should be making sure that the build state updates >>> without me having to reload the page. Once that's done, there will be >>> some >>> UI refinements needed. To see how the cancellation should behave on the >>> UI >>> side of things you can visit: >>> >>> http://www.yoctoproject.org/toaster/project-builds.html >> >> >> Sure we can make the refinement to UI. >> >> >>> >>> Type 'core' in the build text field on the top right hand corner of the >>> page, select one of the suggestions then click build. Once the build >>> appears, click the 'cancel' button. >>> >>> >> Belen, Immediately clicking 'cancel' button, I haven't tried that option. >> > > I have pushed my changes to > http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/log/?h=sujith/toaster-build-cancel10 > With this change user would see the cancel button only after the actual > tasks start executing. So then user can click > cancel button. > I have updated comments and also updated api in orm/models.py : http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/log/?h=sujith/toaster-build-cancel11 > >> Cheers >>> >>> Belén >>> >>> > >>> >This patch set would help user to cancel build from toaster. >>> > >>> > >>> >How to test it: >>> > >>> >a) Start toaster >>> > >>> >b) Create Project >>> > >>> >c) Select the image to build ( I have tested with core-image-sato or >>> >core-image-weston). >>> > >>> >d) Once the image/recipe is triggered to build, a cancel button can be >>> >visible on the right side of the progress bar. >>> > >>> >e) If you wish to cancel the build once the build is triggered click the >>> >cancel button. >>> > >>> >f) Once the cancel is done, the page gets reloaded and user can see in >>> >the toaster build is stopped. >>> > >>> > >>> >Thanks, >>> > >>> >Sujith H >>> > >>> >On Tue, Dec 22, 2015 at 4:19 PM, sujith h >>> > wrote: >>> > >>> >Hi, >>> > >>> > >>> >Made small modification compared to my earlier branch >>> >sujith/toaster-build-cancel2 in : >>> > >>> http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/log/?h=sujith/toast >>> >er-build-cancel3 >>> > >>> >I have tried to split my work into 3 patches >>> > >>> >a) One for UI ( html + js) >>> > >>> >b) One for API >>> > >>> >c) One for toastergui/views.py >>> > >>> > >>> >The only reason why I couldn't remove the line : self.connection = >>> >server.establishConnection([]) from toaster/bldcontrol/bbcontroller.py >>> >file is due to the fact that self.connection is an instance of >>> >bb.server.xmlrpc.BitBakeXMLRPCServerConnection >>> > >>> >and the server returned from >>> >bb.server.xmlrpc._create_server(self.be.bbaddress, int(self.be.bbport)) >>> , >>> >is an instance of ServerProxy. >>> > >>> >So I am not sure if I completely remove self.connection = >>> >server.establishConnection([]) and use >>> >bb.server.xmlrpc._create_server(self.be.bbaddress, >>> >int(self.be.bbport))[0], would cause breakage of code. >>> > >>> > >>> > >>> >Any pointers here would be helpful. >>> > >>> > >>> >Thanks, >>> > >>> > >>> >Sujith H >>> > >>> > >>> >On Mon, Dec 21, 2015 at 6:42 PM, sujith h >>> > wrote: >>> > >>> >Hi, >>> > >>> > >>> >I have updated patch : >>> > >>> http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/log/?h=sujith/toast >>> >er-build-cancel2 >>> >< >>> http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/log/?h=sujith/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 as >>> >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 = 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 = bb.server.xmlrpc.BitBakeXMLRPCClient() >>> > server.initServer() >>> > server.saveConnectionDetails("%s:%s" % (self.be.bbaddress, >>> >self.be.bbport)) >>> > self.connection = server.establishConnection([]) >>> > >>> > self.be.bbtoken = self.connection.transport.connection_token >>> > self.be.save() >>> > >>> > return BitbakeController(self.connection) >>> > >>> > >>> >This would fail in server.establishConnection line. Because internally >>> it >>> >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 >>> >writing 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 = bb.server.xmlrpc._create_server(host, port) >>> > return server >>> > >>> > >>> >And then call this function from toastergui/views.py file: >>> > >>> > br = >>> >BuildRequest.objects.select_for_update().get(project = prj, pk = i, >>> >state__lte = BuildRequest.REQ_INPROGRESS) >>> > bbctrl = >>> >bbcontroller.BuildEnvironmentController(br.environment) >>> > server = >>> >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 = i >>> >).build.errors) > 0: >>> > br.state = BuildRequest.REQ_DELETED >>> > br.save() >>> > build = BuildRequest.objects.get(pk = i >>> >).build >>> > build.outcome = 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=sujith/toast >>> >er-build-cancel >>> >< >>> http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/log/?h=sujith/toas >>> >ter-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 >>> > >>> > >>> > >>> > >>> > >>> > >>> >-- >>> >സുജിത് ഹരിദാസന് >>> >Bangalore >>> >Contributor to KDE project >>> >http://fci.wikia.com/wiki/Anti-DRM-Campaign >>> > http://sujithh.info >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> >-- >>> >സുജിത് ഹരിദാസന് >>> >Bangalore >>> >Contributor to KDE project >>> >http://fci.wikia.com/wiki/Anti-DRM-Campaign >>> > http://sujithh.info >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> >-- >>> >സുജിത് ഹരിദാസന് >>> >Bangalore >>> >Contributor to KDE project >>> >http://fci.wikia.com/wiki/Anti-DRM-Campaign >>> > http://sujithh.info >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> >-- >>> >സുജിത് ഹരിദാസന് >>> >Bangalore >>> >Contributor to KDE project >>> >http://fci.wikia.com/wiki/Anti-DRM-Campaign >>> > http://sujithh.info >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> >-- >>> >സുജിത് ഹരിദാസന് >>> >Bangalore >>> >Contributor to KDE project >>> >http://fci.wikia.com/wiki/Anti-DRM-Campaign >>> > http://sujithh.info >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> >>> >> >> >> -- >> സുജിത് ഹരിദാസന് >> Bangalore >> Contributor to KDE project >> http://fci.wikia.com/wiki/Anti-DRM-Campaign >> http://sujithh.info >> > > > > -- > സുജിത് ഹരിദാസന് > Bangalore > Contributor to KDE project > http://fci.wikia.com/wiki/Anti-DRM-Campaign > http://sujithh.info > -- സുജിത് ഹരിദാസന് Bangalore Contributor to KDE project http://fci.wikia.com/wiki/Anti-DRM-Campaign http://sujithh.info