yejunzhou / typhoonae

Automatically exported from code.google.com/p/typhoonae
0 stars 0 forks source link

The eta argument gets ignored with Celery backed Task Queue #74

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

eta = now + datetime.timedelta(seconds=5)
google.appengine.api.labs.taskqueue.add(url='/worker', eta=eta, 
payload="foobar")

queue.yaml:

queue:
- name: default
  rate: 5/s

What is the expected output? What do you see instead?

The task shouldn't get executed before eta.

Original issue reported on code.google.com by tobias.r...@gmail.com on 10 Oct 2010 at 6:51

GoogleCodeExporter commented 9 years ago
I think the problem is AppEngine is in the UTC timezone, celery workers are in 
whatever timezone your system is.

If I run:
print 'utc:', datetime.datetime.utcnow(), 'local:', datetime.datetime.now()

in a handler in typhoonae I get the same values for utc: and for local:. If I 
run it in a python shell, I get:

utc: 2010-10-17 17:59:46.406544 local: 2010-10-17 10:59:46.406744

The eta that gets generated by the celery API when you specify a countdown is a 
naive datetime, assuming UTC. When the celery worker reads this time, it 
understands it as a naive datetime, assuming your native timezone.

I still don't know how to fix this problem. Tobias, do you know where does 
typhoonae switch to UTC as its timezone?

Original comment by e98cu...@gmail.com on 17 Oct 2010 at 6:00

GoogleCodeExporter commented 9 years ago
I had a similar issue with the old taskworker implementation. Here 
http://code.google.com/p/typhoonae/source/browse/src/typhoonae/taskqueue/__init_
_.py is the code for checking whether a given eta is in the future. Does it 
help?

Original comment by tobias.r...@gmail.com on 17 Oct 2010 at 6:35

GoogleCodeExporter commented 9 years ago
Already fixed in trunk.

Original comment by e98cu...@gmail.com on 27 Oct 2010 at 8:04

GoogleCodeExporter commented 9 years ago
Fixed in the 0.2.0 release.

Original comment by tobias.r...@gmail.com on 13 Dec 2010 at 1:01