2010-3-21
| 21:08 | asksol | and being local, it would be pretty pointless :) |
| 21:09 | asksol | could maybe just write our own |
| 21:10 | asksol | with MemcachedCache as base |
| 21:10 | asksol | cmemcache is pretty outdated |
| 21:10 | asksol | would be nice to support pylibmc |
| 21:11 | Wraithan | Shouldn't be too hard to translate |
| 21:11 | asksol | it has support for the binary protocol, compression, async, tcp nodelay etc |
| 21:14 | Wraithan | Well we could do a direct copy of theirs and switch it to use pylibmc for now, then come back to make it use the better features of pylibmc |
| 21:16 | Wraithan | Is the caching going to want to be django-based if using the django backend and this other caching we are talking about or just single caching setup and drop django cache support |
| 21:17 | asksol | not sure, that's something we should ask the mailinglist |
| 21:18 | Wraithan should probably join it | |
| 21:19 | asksol | but don't have to map out everything |
| 21:20 | asksol | wouldn't be that hard to do either way |
| 21:20 | asksol | I was thinking the loaders could have a override_backend attribute |
| 21:21 | asksol | so the django backend sets the "database" alias to be "djangocelery.backends.database" (or whatever it's called0 |
| 21:21 | asksol | for backward compatibility |
| 21:22 | asksol | s/django backend/django loader |
| 21:23 | asksol | but not sure, need to see it in context when we have the sqlalchemy backend ready |
| 21:24 | asksol | if you want to use sqlalchmey and django, you could just type out the full class name |
| 21:25 | Wraithan | Well I am just going to replace all the signalling stuff with blinker and use that time to get associated with the code bad |
| 21:25 | Wraithan | base |
| 21:25 | Wraithan | Only have a few more hours of dev time today before other commitments take me away from it |
| 21:26 | asksol | the general is putting me in charge of washing clothes here now, been promoted ;) |
| 21:26 | Wraithan | Oh nice! |
| 21:27 | Wraithan | Sometime over the next week or two, it'd be nice to get this mapped out so we have set goals to meet |
| 21:28 | Wraithan | Even if it is a loose map, a good idea of where everything is going makes it easier to hack things out |
| 21:28 | asksol | agreed |
| 21:30 | asksol | good to you have you on board! |
| 21:31 | Wraithan | :) |
| 21:46 | Wraithan | apollo13: I wont be working on the sqlalchemy stuff this weekend, just the signal stuff |
| 21:50 | ed1t | I have a test celery project setup with celery and MQ |
| 21:50 | ed1t | i dont get what the role of MQ is |
| 21:53 | padt | ed1t: MQ as in what? |
| 21:53 | ed1t | RabbitMQ |
| 21:53 | ed1t | i have rabbitMQ, celery and django app running |
| 21:54 | padt | ah. so the questions is, why do you need rabbitmq? |
| 21:54 | ed1t | yes |
| 21:55 | padt | when you run a task, it gets sent to rabbit, which sends it of to one of possily several workers. One of the workers finish the task and sends it back as another message via rabbit |
| 21:56 | ed1t | ok so what does the CELERY_BACKEND is used for? |
| 21:57 | padt | that deals with how the results of a task is stored |
| 21:58 | padt | (see also http://celeryproject.org/docs/configuration.html ) |
| 21:58 | ed1t | i did that part i have configured mogodb |
| 21:58 | ed1t | but i dont see anything written to mongodb |
| 21:59 | padt | but you can run tasks and query the tasks about their status? |
| 22:00 | ed1t | nmv i see it now, i had to do syncdb |
| 22:03 | ed1t | it only writes Task and not PeriodicTask? I ran 2 tasks and have 1 periodictask running |
| 22:03 | ed1t | i only see 2 entries in my mongodb collection |
| 22:04 | padt | Presumably you will get one entry every time the periodic task runs |
| 22:04 | ed1t | i dont see anything |
| 22:04 | padt | I'm not too well versed in the innards of the task data storage though |
| 22:04 | ed1t | this is what I see: { "_id" : "8410fb56-c984-4b7e-8e8a-fb89a958028b", "status" : "SUCCESS", "result" : BinData type: 2 len: 9, "date_done" : "Sun Mar 21 2010 14:02:57 GMT-0400 (EDT)", "traceback" : BinData type: 2 len: 6 } |
| 22:05 | ed1t | which doesnt really make sense...it doesnt say which task |
| 22:06 | padt | the id is there |
| 22:06 | padt | which is what you use to identify an instance of a task |
| 22:08 | padt | but normally you just call methods on the task object. (see http://celeryproject.org/docs/getting-started/f... ) |
| 22:10 | ed1t | backend is optional right? |
| 22:11 | padt | which backend? |
| 22:12 | ed1t | the backend which stores the result of tasks |
| 22:12 | ed1t | in my case, mongodb |
| 22:13 | padt | No, it's not optional as far as I know. Then you would not be able to get results back from your tasks |
| 22:14 | padt | but you can use amqp as the backend, so you wont need a separate db or mongo or anything. there are some caveats. see the config doc I pasted above |
| 22:16 | ed1t | what I was going to do was when the task is ran, in that task I was going to catch the error |
| 22:19 | padt | as in, inside of your task you want to catch an expection or something? |
| 22:19 | padt | is's probably easier if you can paste some code on a pastebin or something |
| 22:21 | ed1t | well im just using one of the sample apps, http://pastebin.com/GHWJdRm5 |
| 22:23 | ed1t | lets say there was any error while processing it, i will to try: except: |
| 22:24 | ed1t | all the datastore is going to tell me is that whether it was succesful or not, it wont tell me the errors |
| 22:29 | padt | you can get the exception back as the result of the task |
| 22:29 | padt | it will be serialized and sent back, just as the result of the task would |
| 22:29 | padt | you can also handle the exception inside of the task if there is a chance you can recover from it |
| 22:31 | Wraithan | You can also refire the task from inside of the task using retries |
| 22:32 | Wraithan | so if it fails it will try again |
| 22:32 | Wraithan | good for when making external connections |
| 22:32 | padt | if mytask.status == "FAILURE" then mytask.result contains the exception |
| 22:33 | padt | and yeah. That's a normal case. retrying whenever you get a failwhale exception or something |
| 22:33 | padt | I'm wondering if the docs needs some prose about catching exceptions though. the api docs are a bit daunting for finding out about something like error handling |
| 22:39 | ed1t | where do I call mytask.status from? |
| 22:43 | padt | ed1t: when you call your task you get a task object back, on which you can check status and so on |
| 22:43 | padt | |
| 22:45 | padt | ed1t: that docs page says "The AsyncResult lets us find the state of the task, wait for the task to finish and get its return value (or exception if the task failed)." |
| 22:46 | ed1t | in django, if i make it wait for the task wouldnt that kinda hang the page too |
| 22:48 | padt | yeah. so in that case, you shouldn't wait for it |
| 22:48 | padt | as you're right, that would defeat he whole point of using celer :) |
| 22:49 | ed1t | yea |
| 22:51 | Wraithan | can't you just look it up by it's id |
| 22:51 | ed1t | so is there like api method where I can do like get_task and pass the id was generated |
| 22:52 | padt | ed1t: you should be able to do taskresult = celery.result.AsyncResult(taskid) |
| 22:54 | padt | as in. in your view or whatever. taskid = MyTask.delay(); save the taskid somewhere and pass it to the AsyncResult constructor later on |
| 22:55 | padt | I guess ask would be the guy to ask if that's the right way, but he's doing laundry and was hit with a netsplit |
| 22:57 | padt | erh. retval from delay is a result object with a task_id member. so that's the one to save |
| 22:59 | ed1t | yep |
Page 2 of 2
← Previous
(191 total)