Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Play with TheSchwartz Hideo Kimura (hidek)
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>...
TheSchwartz <ul><li>Reliable Job queue system </li></ul><ul><ul><li>using MySQL (SQLite is “ok”) </li></ul></ul><ul><li>Mo...
Data::ObjectDriver <ul><li>using Data::ObjectDriver as OR mapper </li></ul><ul><ul><li>job </li></ul></ul><ul><ul><li>func...
TheSchwartz::Simple <ul><li>using DBI dbh directly for Job insertion. </li></ul><ul><li>NOT including worker </li></ul>
Job attributes <ul><li>jobid  </li></ul><ul><li>funcid  </li></ul><ul><li>arg  </li></ul><ul><li>uniqkey  </li></ul><ul><l...
Coalesce Jobs <ul><li>$job->coalesce(“yahoo.com@$id”); </li></ul><ul><li>$client->find_job_with_coalescing_prefix(  ‘MyWor...
Split Job <ul><li>sub work { ... foreach my $id (@ids) {   my $new_job = TheSchwartz::Job->new(   funcname => 'Worker::Chi...
Monitor Jobs <ul><li>$client->list_jobs({'funcname' => 'MyApp::Worker'} ) </li></ul><ul><li>$client->lookup_job($handle_id...
Monitor Jobs from Catalyst <ul><li>use base 'Catalyst::Model::Adaptor'; </li></ul><ul><li>$c->model(‘TheSchwartz’)->insert...
Thank you, and questions?
Upcoming SlideShare
Loading in …5
×

Play With Theschwartz

  • Be the first to comment

Play With Theschwartz

  1. 1. Play with TheSchwartz Hideo Kimura (hidek)
  2. 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. 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. 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. 5. TheSchwartz::Simple <ul><li>using DBI dbh directly for Job insertion. </li></ul><ul><li>NOT including worker </li></ul>
  6. 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. 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. 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. 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. 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. 11. Thank you, and questions?

×