<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>11197</bug_id>
          
          <creation_ts>2017-03-21 04:15:31 +0000</creation_ts>
          <short_desc>Add ability to trigger asynchronous operations</short_desc>
          <delta_ts>2018-01-16 02:02:28 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>6</classification_id>
          <classification>Yocto Project Subprojects</classification>
          <product>Layer Index</product>
          <component>Layer Index</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>Future</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Paul Eggleton">bluelightning</reporter>
          <assigned_to name="Paul Eggleton">bluelightning</assigned_to>
          <cc>brian.avery</cc>
    
    <cc>libertad.gonzalez.de.la.cruz</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>71503</commentid>
    <comment_count>0</comment_count>
    <who name="Paul Eggleton">bluelightning</who>
    <bug_when>2017-03-21 04:15:31 +0000</bug_when>
    <thetext>At the moment there&apos;s no way to trigger asynchronous operations from the web interface. This would be useful for example to trigger one-off manual updates, run the OE-Classic update script, etc.

This bug is for the basic ability to trigger such operations from within the code, and then to use it for sending the email to maintainers when a new layer is submitted (since that is currently synchronous, and if an SMTP error occurs it blocks the submission which is really not desirable).

FWIW I did look into using Celery to implement this but struggled to figure out how to use it. That doesn&apos;t mean Celery isn&apos;t the way to do it, but it did seem pretty heavyweight. Then again, we do not want to be implementing such an asynchonous execution framework ourselves. It may also be worth talking to Michael Halstead to ensure a proposed solution will work well for the layers.openembedded.org infrastructure.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>71642</commentid>
    <comment_count>1</comment_count>
    <who name="brian avery">brian.avery</who>
    <bug_when>2017-03-23 15:16:05 +0000</bug_when>
    <thetext>I did a play project using celery+rabbitmq and it was relatively straightforward.
https://tests4geeks.com/python-celery-rabbitmq-tutorial/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>73962</commentid>
    <comment_count>2</comment_count>
    <who name="Diana Thayer">garbados</who>
    <bug_when>2017-06-09 19:43:27 +0000</bug_when>
    <thetext>(In reply to comment #1)
&gt; I did a play project using celery+rabbitmq and it was relatively
&gt; straightforward.
&gt; https://tests4geeks.com/python-celery-rabbitmq-tutorial/

(In reply to comment #0)
&gt; At the moment there&apos;s no way to trigger asynchronous operations from the web
&gt; interface. This would be useful for example to trigger one-off manual
&gt; updates, run the OE-Classic update script, etc.
&gt; 
&gt; This bug is for the basic ability to trigger such operations from within the
&gt; code, and then to use it for sending the email to maintainers when a new
&gt; layer is submitted (since that is currently synchronous, and if an SMTP
&gt; error occurs it blocks the submission which is really not desirable).
&gt; 
&gt; FWIW I did look into using Celery to implement this but struggled to figure
&gt; out how to use it. That doesn&apos;t mean Celery isn&apos;t the way to do it, but it
&gt; did seem pretty heavyweight. Then again, we do not want to be implementing
&gt; such an asynchonous execution framework ourselves. It may also be worth
&gt; talking to Michael Halstead to ensure a proposed solution will work well for
&gt; the layers.openembedded.org infrastructure.

I&apos;ve got RabbitMQ and Celery up locally, running the update script on command. I&apos;ll tie it into the layer submission view and submit the WIP for review.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>73966</commentid>
    <comment_count>3</comment_count>
    <who name="Diana Thayer">garbados</who>
    <bug_when>2017-06-09 21:51:59 +0000</bug_when>
    <thetext>OK, so I got Celery to run the update command asynchronously, but the update.py main() function parses options from sys.argv, meaning the Celery task can&apos;t configure it on the fly. As part of my patch, I will split out the heavy lifting of main() into do_update() which will accept function parameters. then, main() can call do_update() with appropriate options from sys.argv, and the Celery task can call do_update() with appropriate options from the update view.

Does that sound reasonable?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>73975</commentid>
    <comment_count>4</comment_count>
    <who name="Paul Eggleton">bluelightning</who>
    <bug_when>2017-06-12 07:54:17 +0000</bug_when>
    <thetext>Yep, that sounds reasonable, although if there&apos;s anything we can do to mitigate adding a separate interface that would be great (e.g. perhaps with the function we still just pass options as a structure rather than exploding it into separate function parameters - of course that means all callers need to ensure they keep up with any changes to the command line options, but I think we can live with that for now.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78658</commentid>
    <comment_count>5</comment_count>
    <who name="Rebecca Chang">rebecca.swee.fun.chang</who>
    <bug_when>2017-12-11 09:54:05 +0000</bug_when>
    <thetext>Diana and Paul have work in progress at https://git.yoctoproject.org/cgit/cgit.cgi/layerindex-web/log/?h=paule/celery</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78659</commentid>
    <comment_count>6</comment_count>
    <who name="Paul Eggleton">bluelightning</who>
    <bug_when>2017-12-11 10:09:52 +0000</bug_when>
    <thetext>Actually the base celery changes and the ability to send layer submission emails in the background using it were already merged. I suspect we should mark this bug resolved and open a new one for additional capabilities.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79081</commentid>
    <comment_count>7</comment_count>
    <who name="Paul Eggleton">bluelightning</who>
    <bug_when>2018-01-16 02:02:28 +0000</bug_when>
    <thetext>As per my comment above I have opened bug 12484 to cover triggering updates from the web interface, and am now marking this as resolved.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>