cron job that'll (eventually) get event updates

1 view
Skip to first unread message

Bryan Stearns

unread,
May 8, 2008, 9:11:33 PM5/8/08
to pdx-tech...@googlegroups.com
At the lunchtime mini-sprint yesterday, I checked in a Rake task that'll
(eventually) do occasional reimporting from sources.

For now, here's what "rake sources:update" does:
- Whenever it's run, it retrieves all sources where the "reimport" flag
is set (I think there are about half a dozen in the production database
now) and the "next_update" date has passed.
- For each of these sources:
- It's queried, and abstract events are built.
- A new Update model is created; its "status" attribute gets a message
containing either a count of created abstract events, or the exception
that occurred when we tried.
- The source's next_update time is set for two days from now.
- It discards any Update entries older than two weeks.

There's also "rake sources:prime" (which sets all the 'reimport' sources
to be due for updating) and "rake sources:status" that shows each
source, its most recent update status, and its next_update time.

The idea was:
- Anyone can run it locally for testing
- Anyone who wants to see what's been happening
- It can get run in production as a cron task - hourly's probably fine.
(As a cron task, instead of a long-running service, we don't need to
worry about long-term memory buildup, and we can tweak its behavior by
committing source changes without needing to restart the service.)

What it doesn't do? Actually update or import any events -- that comes
next.

So: can someone please set up a cron job in production, then do
"RAILS_ENV=production rake sources:prime"?

Thanks,
...Bryan

Igal Koshevoy

unread,
May 8, 2008, 9:48:06 PM5/8/08
to pdx-tech...@googlegroups.com
Bryan Stearns wrote:
> At the lunchtime mini-sprint yesterday, I checked in a Rake task that'll
> (eventually) do occasional reimporting from sources.
>
Thank you for building this and providing the thorough write-up. Either
today or tomorrow I'll review the code, get the cron job going, and
report back.

-igal

Igal Koshevoy

unread,
May 9, 2008, 4:09:57 PM5/9/08
to pdx-tech...@googlegroups.com
Bryan Stearns wrote:
> At the lunchtime mini-sprint yesterday, I checked in a Rake task that'll
> (eventually) do occasional reimporting from sources.
Let's take care of reviewing the code and getting it going this weekend
because I'm short on time today.

-igal

igal

unread,
May 11, 2008, 1:01:13 AM5/11/08
to PDX Tech Calendar
On May 8, 6:11 pm, Bryan Stearns <bryanstea...@gmail.com> wrote:
>I checked in a Rake task that'll (eventually) do occasional reimporting from sources.

I've finished writing the task and deployed it to production -- see
Issue #124 for details.

Thanks for the good work, Bryan.

-igal
Reply all
Reply to author
Forward
0 new messages