Google App Engine, best practice to schedule code execution [closed]
2024/11/17 3:45:56
Problem: some users can create a document, and choose date and time in the future, for the execution of some code on that document. The users can also cancel that scheduled event.
I'm looking for the best implementation in GAE. I'm thinking to two possible implementations:
-A push Task for any document, setting the eta parameter, I can save the result of Taskqueue.add(..) in the document, in case the user want to delete the task before its execution. I don't know if there is a max number of tasks that I can launch, and the max number of days for the eta(30) can be a problem.
-I can save in the DataStore datetime and key of the document and use cron
to check every 10 mins if there's a any entry to process. I fear that this approach may be expensive. Am i right?
Answer
Because your users can schedule an event as well as cancel - I would recommend saving the scheduled request to the datastore and have a cron job check if there is anything scheduled at that time.
To reduce the number of times the job runs, you can change the precision of the date/time a user can select for the job (such as 15 minute increments, or hourly). As long as you construct the scheduled request entity properly - it shouldn't be an expensive hit to the datastore. To reduce datastore hits, you can fetch a range of upcoming scheduled events in one query and put them in memcache - as long as you manage that cache when a user modifies one.
I have multiple "," delimited csv files with recorded water pipe pressure sensor data, already sorted by date older-newer. For all original files, the first column always contains dates forma…
This question already has answers here:Immutable vs Mutable types(20 answers)How do I clone a list so that it doesnt change unexpectedly after assignment?(24 answers)Closed 4 years ago.In python : I h…
Looking for help with my program. There is a text file with 5 first and last names and a number grade corresponding to each person. The task is to create a user name and change the number grade to a le…
I am new to python. please help me how I should proceed.
The following dataframe contains large blocks of NaNs. # Fill the NAs with mean only for 2 or less consecutive values of NAs. # Refer to the d…
I have two dictionaries:dict_1 = ({a:1, b:2,c:3})
dict_2 = ({x:4,y:5,z:6})I want to take the keys from dict_1 and values from dict_2
and make a new dict_3dict_3 = ({a:4,b:5,c:6})
It is very common to have struct-like types that are not expected to be modified by distant copyholders.A string is a basic example, but thats an easy case because its excusably immutable -- Python is …
Closed. This question needs debugging details. It is not currently accepting answers.Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to repro…
Im just starting with python and im having a problem. Ive tried various solutions, but i cant update the field that says 19. When i click on plus, i want it to be 20, then 21,... and when i click - it …
Closed. This question needs to be more focused. It is not currently accepting answers.Want to improve this question? Update the question so it focuses on one problem only by editing this post.Closed 5…
I am new to Python and Im sure that Im doing something wrong - I would like to ask a user for three numbers and print their sum, heres my current code:for i in range(0, 3):total = Nonenum = input(Pleas…