Your SlideShare is downloading. ×
0
Play With Theschwartz
Play With Theschwartz
Play With Theschwartz
Play With Theschwartz
Play With Theschwartz
Play With Theschwartz
Play With Theschwartz
Play With Theschwartz
Play With Theschwartz
Play With Theschwartz
Play With Theschwartz
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Play With Theschwartz

3,414

Published on

Published in: Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,414
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
7
Comments
0
Likes
3
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Play with TheSchwartz Hideo Kimura (hidek)
  • 2. about me <ul><li>name: </li></ul><ul><ul><li>hide-k </li></ul></ul><ul><ul><li>hidek </li></ul></ul><ul><ul><li>hide </li></ul></ul><ul><ul><li>hide-san </li></ul></ul><ul><ul><li>hideki </li></ul></ul><ul><ul><li>hidekku… </li></ul></ul><ul><ul><li>whatever you want to call =) </li></ul></ul><ul><li>working at: </li></ul><ul><ul><li>KDDI Web Communications (hosting company) </li></ul></ul><ul><li>perl: </li></ul><ul><ul><li>office: developing management control panel for customers </li></ul></ul><ul><ul><li>private: perl-users.jp, catalyst </li></ul></ul>
  • 3. TheSchwartz <ul><li>Reliable Job queue system </li></ul><ul><ul><li>using MySQL (SQLite is “ok”) </li></ul></ul><ul><li>MovableType </li></ul><ul><li>CodeRepos commit ping </li></ul><ul><li>sending tons of emails </li></ul><ul><li>creating guest hosts for VPS </li></ul>
  • 4. Data::ObjectDriver <ul><li>using Data::ObjectDriver as OR mapper </li></ul><ul><ul><li>job </li></ul></ul><ul><ul><li>funcmap </li></ul></ul><ul><ul><li>error </li></ul></ul><ul><ul><li>exitstatus </li></ul></ul><ul><ul><li>note </li></ul></ul>
  • 5. TheSchwartz::Simple <ul><li>using DBI dbh directly for Job insertion. </li></ul><ul><li>NOT including worker </li></ul>
  • 6. Job attributes <ul><li>jobid </li></ul><ul><li>funcid </li></ul><ul><li>arg </li></ul><ul><li>uniqkey </li></ul><ul><li>insert_time </li></ul><ul><li>run_after </li></ul><ul><li>grabbed_until </li></ul><ul><li>priority </li></ul><ul><li>coalesce </li></ul>
  • 7. Coalesce Jobs <ul><li>$job->coalesce(“yahoo.com@$id”); </li></ul><ul><li>$client->find_job_with_coalescing_prefix( ‘MyWorker’, ‘yahoo.com’ ); </li></ul>
  • 8. Split Job <ul><li>sub work { ... foreach my $id (@ids) { my $new_job = TheSchwartz::Job->new( funcname => 'Worker::Child', args => $args coalesce => &quot;parent-$id&quot;, ); push @new_jobs, $new_job; } $job->replace_with(@new_jobs); } </li></ul>
  • 9. Monitor Jobs <ul><li>$client->list_jobs({'funcname' => 'MyApp::Worker'} ) </li></ul><ul><li>$client->lookup_job($handle_id) </li></ul><ul><li>$client->find_job_with_coalescing_prefix( $class, $prefix ) </li></ul><ul><li>$client->find_job_with_coalescing_value( $class, $value ) </li></ul>
  • 10. Monitor Jobs from Catalyst <ul><li>use base 'Catalyst::Model::Adaptor'; </li></ul><ul><li>$c->model(‘TheSchwartz’)->insert($job); </li></ul><ul><li>$c->stash->{jobs} = $c->model('TheSchwartz')->list_jobs( {'funcname' => 'MyApp::Worker'} ); </li></ul>
  • 11. Thank you, and questions?

×