Play With Theschwartz

  • 3,127 views
Uploaded on

 

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
3,127
On Slideshare
0
From Embeds
0
Number of Embeds
1

Actions

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