2010-2-18

00:02 otherjacob
asksol: you there?
00:03 otherjacob
curious strikes: if on .8, we're running some periodic tasks, and we don't notice for a few days that, oh id on't know, celerybeat isn't running. would those tasks ever get run in any fashion?
09:52 avisual
Hi, I am playing with celery. Just wondering if there is anyway of pausing a task so that you may come back to it at a later time?
10:03 d0ugal
avisual, You can set an eta so a task runs at a specific time (datetime instance)
10:04 mulka
avisual: I'm curious... why would you want to do that?
10:04 d0ugal
avisual, or you can use countdown (i think) so set a task to run in X seconds
10:05 mulka
avisual: you could add a call to sleep() in your task, but I'm not sure why you would want to do that
10:08 avisual
if i have a number of tasks that are doing bulk inserts into DB. my limiting factor is I/O if i want to stop/pause a task so that i could shift another task into place as that new task became a higher priority
10:11 avisual
Did that make sense?
10:11 mulka
avisual: I don't think there's any direct support in celery to do something like that, but you could certainly implement it yourself by having the task monitor a message queue and reschedule itself for later
10:12 mulka
celery does support priorities, but I don't think it will pause a task for you
10:13 avisual
ok so you can reschedule? Thanks :)
10:13 mulka
oh... I was wrong... AMQP supports priorities, but RabbitMQ doesn't implement them
10:14 mulka
10:14 avisual
Ahh but if the task is running already. I'll need to record where it is in its task and then stop it and add it back into the que
10:15 avisual
Mulka : thanks
10:54 asksol
ah, finally some real coffee
10:58 asksol
avisual: you're implementing distributed coroutines? :)
11:02 asksol
or continuation
11:03 asksol
that would be awesome, if you could send the stack of a generator and continue it elsewhere
11:03 asksol
I wonder if that's how Seaside et.al does it?
11:03 asksol
etc
11:20 rlotun
Hi all - quick question. Say I have a Task with a high eta (like, tomorrow) - how do I cancel it?
11:32 asksol
celery.task.control.revoke(task_id)
11:32 asksol
but currently, this does not persist
11:32 asksol
so if you restart the workers, the revokes are lost
11:33 asksol
but that's probably fine for this
11:34 asksol
oh, there's a bug there actually
11:34 asksol
that's a use case I didn't think through
11:35 asksol
if the task is already received, and is hold by the scheduler, it won't be revoked until the eta has passed
11:36 rlotun
hmm, how much work would you estimate it would be to persist revokes, and cancel them as soon as revoke is called?
11:36 rlotun
I'm happy to help with this
11:37 asksol
persist revokes, I've been thinking about it
11:38 asksol
celerybeat already uses shelve to store persistent data
11:38 asksol
celeryd should probably also have a shelve to store things in
11:39 rlotun
makes sense
11:39 asksol
it probably shouldn't take that long
11:39 asksol
i'm fixing the schedule bug thing right now
11:39 rlotun
also, on a somewhat related note
11:39 rlotun
cool, thanks!
11:39 rlotun
I have a mixed environment - one part Django and one part Twisted
11:39 rlotun
Celery fits in brilliantly with the Django part (thanks for this)
11:40 rlotun
the only thing I'm concerned with (and keep in mind I haven't really read any celery code yet)
11:40 rlotun
is executing task.delay within the Twisted reactor
11:40 rlotun
task.delay shouldn't be blocking, right?
11:41 rlotun
that is, it must simply send a message to the broker and return a id to track the pending task
11:41 rlotun
I image it does this in a thread?
11:41 rlotun
imagine
11:43 underseapilot
rlotun, you are correct sir.
11:44 asksol
it is blocking, in the sense it opens up a connection and sends the message
11:44 rlotun
for now, I can run task.delay in a thread within Twisted then to make it "non-blocking"
11:44 asksol
yeah
11:44 rlotun
I wonder though, a Twisted-safe task could be useful
11:44 asksol
maybe you could add support for sending it via txAMQP as well
11:45 rlotun
yes, I was just thinking that
11:45 rlotun
I'll have a play with that, and let you know
11:46 rlotun
any pointers in general? I was thinking of writing some extra task.control routines to support this
11:46 rlotun
make sense?
11:46 asksol
to support what?
11:47 rlotun
Twisted-safe task submissions using txAMQP
11:47 asksol
the most complete way would be to implement a carrot backend for it
11:47 asksol
it already has a Pika asyncore backend
11:47 rlotun
ahh, ok
11:48 asksol
but I'm the only one that has ever written a carrot backend, so :)
11:48 asksol
who
11:48 asksol
but it's just sending a message
11:49 asksol
11:49 asksol
.control is for broadcast control command messages
11:49 rlotun
ok, got you
11:50 rlotun
just looking at the carrot backends in github now
11:53 avisual
Asksol: Do you think it could be done re. continuation/coroutines?
11:55 asksol
maybe in a functional language, not so sure with python
11:56 asksol
at least not easily, maybe with some C or bytecode
11:56 asksol
11:56 rlotun
avisual: Maybe with Stackless or greenlets
11:57 rlotun
asksol: cool, thanks
11:58 asksol
yeah, stackless or greenlets, good idea
11:58 asksol
or at least good place to look. it would be an awesome feature
11:58 avisual
hanks will have a look at them
11:58 avisual
I'll keep the room updated with what i find
11:58 asksol
although, probably easier to get what you want by manual means
11:59 rlotun
asksol: regarding Twisted, everything boils down to TaskPublisher.delay_task, which sends off a Django signal, right? what listens on that signal?
11:59 asksol
nothing by default
11:59 rlotun
oh ok, I see now
11:59 asksol
It's not recommended to listen to it either
12:01 rlotun
ahh, sorry, missed out that it's the Publisher from carrot.messaging, and the send method. Ok, I've followed it all the way through and understand it better now ;-)
18:16 blackbrrr
i have it in my head that celery has a rest api - am i crazy?
18:20 blackbrrr
and of course a quick trip to the docs answered that.
19:53 rburhum
Hello, I am writing a simple postgresql custom job management web app, and they pointed me to celery
19:54 rburhum
is there a front end that shows me what celery jobs have been started - are finished?
20:00 underseapilot
you can try setting up http://github.com/ask/celerymon
20:02 rburhum
ah
20:03 rburhum
I'll take a look at that
21:51 rburhum
how do I ask the registry if my task is done?
21:52 rburhum
actually , let me give more context... first I do a request using delay, and the process starts in the background... then, I want to implement a function that asks the registry if it is done
22:29 asksol
rburhum: result = Task.delay(...)
22:29 asksol
result.is_ready()
22:29 rburhum
but I don't have the result
22:29 rburhum
it is on a different request
22:29 asksol
sorry.
Page 1 of 2   Next →(164 total)