Hi,

Finally I arrived at :
http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/log/?h=sujith/toaster-build-cancel9
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 <[email protected]> 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/toaster-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 <[email protected]> wrote:
>
>> Hi,
>>
>> I have updated patch :
>> http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/log/?h=sujith/toaster-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 <[email protected]> wrote:
>>
>>> Hi,
>>>
>>>
>>> On Sat, Dec 19, 2015 at 8:57 PM, sujith h <[email protected]> wrote:
>>>
>>>> Hi,
>>>>
>>>> On Fri, Dec 18, 2015 at 7:16 PM, Ed Bartosh <[email protected]
>>>> > 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/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
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> സുജിത് ഹരിദാസന്
>>>> Bangalore
>>>> <Project>Contributor to KDE project
>>>> http://fci.wikia.com/wiki/Anti-DRM-Campaign
>>>> <Blog> http://sujithh.info
>>>>
>>>
>>>
>>>
>>> --
>>> സുജിത് ഹരിദാസന്
>>> Bangalore
>>> <Project>Contributor to KDE project
>>> http://fci.wikia.com/wiki/Anti-DRM-Campaign
>>> <Blog> http://sujithh.info
>>>
>>
>>
>>
>> --
>> സുജിത് ഹരിദാസന്
>> Bangalore
>> <Project>Contributor to KDE project
>> http://fci.wikia.com/wiki/Anti-DRM-Campaign
>> <Blog> http://sujithh.info
>>
>
>
>
> --
> സുജിത് ഹരിദാസന്
> Bangalore
> <Project>Contributor to KDE project
> http://fci.wikia.com/wiki/Anti-DRM-Campaign
> <Blog> http://sujithh.info
>



-- 
സുജിത് ഹരിദാസന്
Bangalore
<Project>Contributor to KDE project
http://fci.wikia.com/wiki/Anti-DRM-Campaign
<Blog> http://sujithh.info
-- 
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster

Reply via email to