<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<meta content="text/html; charset=UTF-8">
<style type="text/css" style="">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
<div dir="ltr">
<div id="x_divtagdefaultwrapper" style="font-size:12pt; color:#000000; font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Dear Gerald,</p>
<p><br>
</p>
<p></p>
<div>Many thanks for a comprehensive and helpful reply.  I am now running my service asynchronously, which I clearly hadn't told Zoo to do before, despite thinking I was!  I am pleased the GetStatus request is available in Zoo even using WPS 1.0.0 where it
 is not implemented in the standard.  I was thinking I would have to use 2.0.0, where Execute only supports POST within the body of the request.</div>
<div><br>
</div>
<div>I think I'm pretty close to having this working now.  The only problem I now have relates to the URL rewriting.  My execute response document statusLocation looks like:</div>
<div><br>
</div>
<div>statusLocation="http://<server>/cgi-bin/zoo_loader.cgi/call/GetStatus/c40d5f9c-951e-11e6-a413-0050560119d2"</div>
<div><br>
</div>
<div>which is a hybrid of the non-mod_rewrite URL /cgi-bin/zoo_loader.cgi?... and the more REST-style URL I would expect (/zoo/call/GetStatus/<sid>).  I suspect this is due to the entries in main.cfg:</div>
<div><br>
</div>
<div>serverAddress = http://<server>/zoo</div>
<div>rewriteUrl = call</div>
<div><br>
</div>
<div>The .htaccess file containing these rules:</div>
<div><br>
</div>
<div>RewriteEngine on</div>
<div>RewriteRule call/GetStatus/(.*) /cgi-bin/zoo_loader.cgi?request=Execute&service=WPS&version=1.0.0&Identifier=GetStatus&DataInputs=sid=$1 [L,QSA]</div>
<div>RewriteRule call/(.*)/(.*) /cgi-bin/zoo_loader.cgi?request=Execute&service=WPS&version=1.0.0&Identifier=$1&DataInputs=uuid=$2 [L,QSA]</div>
<div>RewriteRule (.*)/(.*) /cgi-bin/zoo_loader.cgi?metapath=$1 [L,QSA]</div>
<div>RewriteRule (.*) /cgi-bin/zoo_loader.cgi [L,QSA]</div>
<div><br>
</div>
<div>is in /var/www/zoo.  As you can see I've modified the documented ones a bit as my service has a "uuid" data input, and I think GetStatus requires it to be called "sid".  My understanding is that these should work, and indeed I can call my service successfully
 using:</div>
<div><br>
</div>
<div>http://<server>/zoo/call/<ServiceIdentifier>/<uuid></div>
<div><br>
</div>
<div>as expected.  What's controlling the URL that gets written into the statusLocation attribute?</div>
<div><br>
</div>
<div>Many thanks,</div>
<div><br>
</div>
<div>David.</div>
<div><br>
</div>
<br>
<p></p>
<p></p>
<div class="x_line" style="font-family:monospace; font-size:13px"><span class="x_html-tag"></span></div>
<br>
<p></p>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Fenoy Gerald <gerald.fenoy@geolabs.fr><br>
<b>Sent:</b> 18 October 2016 10:19:40<br>
<b>To:</b> Herbert, David J.<br>
<b>Cc:</b> ZOO-discuss<br>
<b>Subject:</b> Re: [Zoo-discuss] zoo.update_status in a Python Zoo service</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">Hello David,<br>
it seems that you have identified clearly what the update_status is for.<br>
<br>
As you can see is the very basic example [1] demo service which use update_status, you can also add a message by using the conf[[« lenv »][« message »]. Personally, I would try this service first on the same platform where the error occurred to be sure that
 the issue also occur for this one.<br>
<br>
Obviously, only using the update_status function won’t make automatically your service running asynchronously. Indeed, this is defined in the client request by using the storeExecuteResponse=true and status=true for WPS 1.0.0.<br>
<br>
I think in your case this is the issue, you are trying to execute the service without asking to run it asynchronously, which mean that it will run only after returning to the client a Url (statusLocation) that can be polled for details about the ongoing status.<br>
<br>
So to try with the demo service, load the following Url:<br>
<br>
<a href="http://localhost/cgi-bin/zoo_loader.cgi?request=Execute&service=wps&version=1.0.0&Identifier=demo&DataInputs=a=toto&status=true&storeExecuteResponse=true">http://localhost/cgi-bin/zoo_loader.cgi?request=Execute&service=wps&version=1.0.0&Identifier=demo&DataInputs=a=toto&status=true&storeExecuteResponse=true</a><br>
<br>
This should return a valid Execute response document containing the statusLocation that you can poll. Something like the following:<br>
<br>
<a href="http://localhost/cgi-bin/mm/zoo_loader.cgi?request=Execute&service=WPS&version=1.0.0&Identifier=GetStatus&DataInputs=sid=B9E80F8C-9512-11E6-8081-000C6C07034C&RawDataOutput=Result">http://localhost/cgi-bin/mm/zoo_loader.cgi?request=Execute&service=WPS&version=1.0.0&Identifier=GetStatus&DataInputs=sid=B9E80F8C-9512-11E6-8081-000C6C07034C&RawDataOutput=Result</a><br>
<br>
Note that the ressource produced by the GetStatus service is not stored but generated by coupling the execute response stored on the file system and the last couple message/pourcent stored in a shared memory segment or in a db backend.<br>
<br>
I hope this simple example will work on your side and will help you to figure out what happen in your own service, in other case please feel free to add more information about the debugging of the service execution, maybe by running it from the command line.<br>
<br>
I hope to hear back from you.<br>
Best regards,<br>
<br>
<br>
[1] <a href="http://zoo-project.org/trac/browser/trunk/zoo-project/zoo-services/utils/status/cgi-env/service.py">
http://zoo-project.org/trac/browser/trunk/zoo-project/zoo-services/utils/status/cgi-env/service.py</a><br>
<br>
> Le 14 oct. 2016 à 16:55, Herbert, David J. <darb1@bas.ac.uk> a écrit :<br>
> <br>
> Hello,<br>
> <br>
> I am developing a Zoo WPS service in Python on an Ubuntu 14.04 Linux platform.  The particular service includes the download of quite large image files, so can obviously be quite long running, especially for slow ftp sites. 
<br>
> <br>
> I am confused by the documentation about the Zoo status service, which I am thinking allows the querying by a client of the continued progress of the long running service.  I am assuming it uses the storeExecuteResponse capability of WPS to update a document
 at a given URL with progress information (a percentage complete figure, for example).
<br>
> <br>
> So I have Python code which iterates chunk-wise over the content of a large image, computes an integer percentage complete figure, and calls zoo.update_status(conf, percent_complete).  I would expect this to update a web-accessible document somewhere (and
 another question I have is : where exactly, as a URL, is this document so I can access progress of my service?).  I am confident I am passing a valid service configuration object to the call, and a valid integer between 0 and 100. When I make the call, I get
 the error:<br>
> <br>
> /usr/lib/python2.7/threading.py:1160: RuntimeWarning: tp_compare didn't return -1 or -2 for exception<br>
> return _active[_get_ident()]<br>
> <br>
> The request then hangs and eventually times out.  If I remove the update_status call, the download proceeds perfectly, according to trace in the Apache log and the returned XML document from the service itself.  Surrounding the zoo.update_status call with
 a blanket try/except doesn't reveal any more information about what the error was unfortunately.  It seems like it might be a rather low level error?<br>
> <br>
> I built the status service according to:<br>
> <br>
> <a href="http://www.zoo-project.org/docs/services/status.html">http://www.zoo-project.org/docs/services/status.html</a><br>
> <br>
> and did not receive any errors in the build process, and copied all necessary files to the right places as far as I know.  I am also using the mod_rewrite rules for URLs according to:<br>
> <br>
> <a href="http://www.zoo-project.org/docs/kernel/install-debian.html#rewrite-rule-configuration">
http://www.zoo-project.org/docs/kernel/install-debian.html#rewrite-rule-configuration</a><br>
> <br>
> Which appears to be working well, again as far as I can see.<br>
> <br>
> Can someone enlighten me as to what the above error might be?  Googling other occurrences of this particular error (only found in contexts other than Zoo) haven't sparked off any ideas on my part. 
<br>
> <br>
> Hope someone can help!  Happy to provide more info/code etc if this can help tracking it down.<br>
> <br>
> Best regards,<br>
> <br>
> David Herbert<br>
> British Antarctic Survey<br>
> This message (and any attachments) is for the recipient only. NERC is subject to the Freedom of Information Act 2000 and the contents of this email and any reply you make may be disclosed by NERC unless it is exempt from release under the Act. Any material
 supplied to NERC may be stored in an electronic records management system.<br>
> _______________________________________________<br>
> Zoo-discuss mailing list<br>
> Zoo-discuss@lists.osgeo.org<br>
> <a href="http://lists.osgeo.org/mailman/listinfo/zoo-discuss">http://lists.osgeo.org/mailman/listinfo/zoo-discuss</a><br>
<br>
<br>
<br>
Gérald Fenoy<br>
<a href="http://wiki.osgeo.org/wiki/User:Djay">http://wiki.osgeo.org/wiki/User:Djay</a><br>
<br>
</div>
</span></font>
<hr>
<small>This message (and any attachments) is for the recipient only. NERC is subject to the Freedom of Information Act 2000 and the contents of this email and any reply you make may be disclosed by NERC unless it is exempt from release under the Act. Any material
 supplied to NERC may be stored in an electronic records management system</small>.
<hr>
</body>
</html>