I have a client pipeline that needs to send a request to an external computing server and then get the results. The calculation takes some time, so the external server processes it in the task queue. The client conveyor is not quite sure when the results will be ready; instead, it should poll the server (get_status (id)), and then, if status == Completed, get the results (get_results (id))
The problem is that the server crashes from time to time, in which case I need the client pipeline to try again. I have a pipeline template based on this post:
Google AppEngine Pipelines APIs
which is as follows:
class ReducePipeline(pipeline.Pipeline): def run(self, *args): results=[result for result in list(args) if result] if results==[]: return None return results[0] class CallbackPipeline(pipeline.Pipeline): def run(self, id): status=get_status(id)
but this does not work on dev_appserver.py, just causing repeated errors at the completion stage of StartPipeline. I was hoping to return all StartPipeline for a restart.
Can someone advise me on a reasonable sample for retrying to start StartPipeline when getting None results?
Thanks.
source share