Re: Periodic tasks.

2007-05-30 Thread momobear
On May 29, 2:33 pm, Ramashish Baranwal <[EMAIL PROTECTED]>
wrote:
> Hi,
>
> I am trying to execute some tasks periodically, those familiar with
> unix can think of it as equivalent to cron jobs. I have tried looking
> around, but couldn't find a way. Would appreciate any pointers or
> clues..
>
> Thanks,
> -Ram

I googled "twisted cron", if u use twisted, that's maybe help u:
http://svn.zope.org/Zope3/trunk/src/scheduler/cron.py?rev=38967&view=auto
http://twistedmatrix.com/pipermail/twisted-python/2006-June/013525.html

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Periodic tasks.

2007-05-30 Thread vasudevram
Steve Howell wrote:

>Thanks.  Here are two links, not sure those are
>exactly what are being referenced here, but look in
>the ballpark:

> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/413137

> http://docs.python.org/lib/module-sched.html

You're welcome.

The ActiveState recipe you mention above is not the one I meant,
although it uses sched.
I saw the recipe that I mentioned, in the print version of the Python
Cookbook, when reading it a few days ago.

The second link above you mention is right, its about the sched
library.

Also just found these other recipes in the online Python Cookbook, may
or may not be of help to you:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496800
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/114644


Vasudev Ram
www.dancingbison.com


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Periodic tasks.

2007-05-30 Thread Irmen de Jong
Ramashish Baranwal wrote:
> Hi,
> 
> I am trying to execute some tasks periodically, those familiar with
> unix can think of it as equivalent to cron jobs. I have tried looking
> around, but couldn't find a way. Would appreciate any pointers or
> clues..
> 
> Thanks,
> -Ram
> 


Have a look at Kronos, a simple task scheduler I wrote a while ago,
based on sched. It's part of Turbogears as well:
http://trac.turbogears.org/browser/trunk/turbogears/scheduler.py


--Irmen
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Periodic tasks.

2007-05-29 Thread Steve Howell

--- vasudevram <[EMAIL PROTECTED]> wrote:

> On May 29, 4:39 pm, Steve Holden
> <[EMAIL PROTECTED]> wrote:
> 
> > Alternatively, the user could make use of the
> already-existing "sched"
> > module from the standard library. With a little
> threading that would do
> > the job fine.
> 
> Yes. Also, there's an example in the Python Cookbook
> (print edition)
> which is exactly about this - using sched. The
> recipe before that also
> shows how to do it without using the sched library.
> Both those recipes
> are purely in Python.

Thanks.  Here are two links, not sure those are
exactly what are being referenced here, but look in
the ballpark:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/413137

http://docs.python.org/lib/module-sched.html





   
Looking
 for a deal? Find great prices on flights and hotels with Yahoo! FareChase.
http://farechase.yahoo.com/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Periodic tasks.

2007-05-29 Thread vasudevram
On May 29, 4:39 pm, Steve Holden <[EMAIL PROTECTED]> wrote:

> Alternatively, the user could make use of the already-existing "sched"
> module from the standard library. With a little threading that would do
> the job fine.
>
> regards
>   Steve
> --
> Steve Holden+1 571 484 6266   +1 800 494 3119
> Holden Web LLC/Ltd  http://www.holdenweb.com
> Skype: holdenweb  http://del.icio.us/steve.holden
> -- Asciimercial -

Yes. Also, there's an example in the Python Cookbook (print edition)
which is exactly about this - using sched. The recipe before that also
shows how to do it without using the sched library. Both those recipes
are purely in Python.

Vasudev Ram
Dancing Bison Enterprises
www.dancingbison.com


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Periodic tasks.

2007-05-29 Thread Steve Holden
Ben Finney wrote:
> Ramashish Baranwal <[EMAIL PROTECTED]> writes:
> 
>> I am trying to execute some tasks periodically, those familiar with
>> unix can think of it as equivalent to cron jobs.
> 
> Can you not use cron? If not, why not? Is there an equivalent service
> you can use?
> 
>> I have tried looking around, but couldn't find a way.
> 
> Using the services provided by the operating system would be far
> preferable to re-inventing a scheduler service.
> 
Alternatively, the user could make use of the already-existing "sched" 
module from the standard library. With a little threading that would do 
the job fine.

regards
  Steve
-- 
Steve Holden+1 571 484 6266   +1 800 494 3119
Holden Web LLC/Ltd   http://www.holdenweb.com
Skype: holdenweb  http://del.icio.us/steve.holden
-- Asciimercial -
Get on the web: Blog, lens and tag your way to fame!!
holdenweb.blogspot.comsquidoo.com/pythonology
tagged items: del.icio.us/steve.holden/python
All these services currently offer free registration!
-- Thank You for Reading 

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Periodic tasks.

2007-05-29 Thread Ramashish Baranwal
> > I am trying to execute some tasks periodically, those familiar with
> > unix can think of it as equivalent to cron jobs.
>
> Can you not use cron? If not, why not? Is there an equivalent service
> you can use?

I can, but the work I want to do is written in Python. This is not an
issue but I would have more than one such tasks running at different
periods and it will be desirable to control or monitor all of them
from a single process. If I use cron, all of them will execute
independently.

>
> > I have tried looking around, but couldn't find a way.
>
> Using the services provided by the operating system would be far
> preferable to re-inventing a scheduler service.

Agreed, but my requirement is a little different. There is a TaskKit
package (http://webware.sourceforge.net/Webware-0.7/TaskKit/Docs/
QuickStart.html) that has such a scheduler. Does anyone have any
experience with it?

Ram

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Periodic tasks.

2007-05-29 Thread Steve Howell

--- Ramashish Baranwal <[EMAIL PROTECTED]>
wrote:

> Hi,
> 
> I am trying to execute some tasks periodically,
> those familiar with
> unix can think of it as equivalent to cron jobs. I
> have tried looking
> around, but couldn't find a way. Would appreciate
> any pointers or
> clues..
> 

I'm also interested in this.  On the assumption that
you can't find a cron replacement in your OS, or that
maybe you need a Python-written cron to do something a
little different than cron, these are some things to
look at:

   open(fn).readlines()
   line.split(' ', 6)
   time.sleep(), time.time() and other methods
   os.popen.readlines() (but others may disagree)

In my case I need to run jobs periodically, but before
running jobs, but I need to configure the times that
the jobs run using a database, and I need to check on
the status of the previous day's job, make sure that
I'm running on the primary box, etc.

Another technique people use is to use cron() and make
it the responsibility of the scheduled programs to
check that they should really proceed, and if there's
a chance of overlapping with a previous job that's
still running, you can use a file-locking scheme.


   


 

Sucker-punch spam with award-winning protection. 
Try the free Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/features_spam.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Periodic tasks.

2007-05-29 Thread Ben Finney
Ramashish Baranwal <[EMAIL PROTECTED]> writes:

> I am trying to execute some tasks periodically, those familiar with
> unix can think of it as equivalent to cron jobs.

Can you not use cron? If not, why not? Is there an equivalent service
you can use?

> I have tried looking around, but couldn't find a way.

Using the services provided by the operating system would be far
preferable to re-inventing a scheduler service.

-- 
 \ Contentsofsignaturemaysettleduringshipping. |
  `\   |
_o__)  |
Ben Finney

-- 
http://mail.python.org/mailman/listinfo/python-list


Periodic tasks.

2007-05-28 Thread Ramashish Baranwal
Hi,

I am trying to execute some tasks periodically, those familiar with
unix can think of it as equivalent to cron jobs. I have tried looking
around, but couldn't find a way. Would appreciate any pointers or
clues..

Thanks,
-Ram

-- 
http://mail.python.org/mailman/listinfo/python-list