I am trying to build a web app on Google App Engine (GAE) using python and
Flask. I want to know how to call a function within the app multiple times
simultaneously. For example, I have a function which returns the square of
an element. Now, I wrap this function under a URL like this:
@app.route('/single_number',methods = ['GET','POST'])
def square():
x = request.form.get('input_number')
return x*x
Now, I want to do this on a list of numbers but concurrently on '
http://localhost:8080/list_of_numbers'. Say, I have a list of 'n' numbers
and I want to calculate the square of each number simultaneously (if not
all 'n' together but at least what Google App Engine allows). I have used
multiprocessing library of Python but got no performance improvement
because of the single core used in Google App Engine instance and
apparently, multithreading is equally futile. So, upon reading some more I
was led to Cloud Tasks of GAE. But I am not able to wrap my head around
executing this on Cloud Tasks. Any sample/tutorial related to this will be
greatly appreciated. If you think that Cloud Tasks is not the right way for
this problem, is it possible to create a function under handler
'/list_of_numbers', which will send multiple numbers of the list to the
'/single_number' handler simultaneously? Or do you suggest any other method?
I am new to web-app building and GAE. So, any help would be greatly
appreciated.
Thanks in advance
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-appengine/2e8edc65-c307-4eed-8d03-ac6e921201a0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.