SlideShare una empresa de Scribd logo
1 de 30
Rooster
Rooster
•    It does the same thing everyday at the
    same time, whether you are sleeping or not
Rooster

• Designed to run periodic tasks, on schedule
History
• Previously we used the daemons gem plus
  the daemon generator plugin.
• Headaches:
 • Each daemon is a separate process.
 • Not very DRY:
Not DRY
• Each daemon has two files:
 • The actual code that runs as a daemon
    (e.g. network_point_update_daemon.rb)
•
Not DRY
• Each daemon has two files:
 • And a daemon control script
    (e.g. network_point_update_daemon_ctl)
•
Not DRY
• The only bit of code that actually does our work:
  AppUser.daily_amount_grant

• The Rails environment is loaded within each
  daemon process! Not good for memory.
• No centralized logging/error handling; poignantly
  recognized when we wanted exceptions emailed to
  us.
• Management of each daemon process required
  another entry into monit's config file (eww!):
Back To The Future
(of scheduled tasks)
Rooster
Rooster
What does it do?
Rooster
     What does it do?
Scratches the itches of our previous
configuration
Rooster
                            It’s DRY
• One daemon, monitored by monit
• One Rails environment, loaded once
• Easier management:  TCP server (easily
  accessed by telnet), rake tasks, more to come...
• Centralized and configurable error handling and
  logging:
  Rooster::Runner.error_handler = lambda { |e| HoptoadNotifier.notify(e) }
How?



•   Rooster leverages 3 (optionally 4) excellent open source bits of
    software:
How?


•   Rooster leverages 3 (optionally 4) excellent open source bits of
    software:

    •   EventMachine:  provides event-driven I/O using the Reactor
        pattern.  It lets you write network clients and servers without
        handling sockets.
How?

•   Rooster leverages 3 (optionally 4) excellent open source bits of
    software:

    •   EventMachine:  provides event-driven I/O using the Reactor
        pattern.  It lets you write network clients and servers without
        handling sockets.

    •   Rufus Scheduler:   a Ruby gem for scheduling pieces of
        code (can leverage EventMachine if available).
How?
•   Rooster leverages 3 (optionally 4) excellent open source bits of
    software:

    •   EventMachine:  provides event-driven I/O using the Reactor
        pattern.  It lets you write network clients and servers without
        handling sockets.

    •   Rufus Scheduler:   a Ruby gem for scheduling pieces of
        code (can leverage EventMachine if available).

    •   daemons:  A Ruby gem that provides an easy way to wrap
        existing ruby code to be run as a daemon, and to be
        controlled by simple start/stop/restart commands.   (I know we
        moved away from our previous daemons-based solution, but
        not all daemons are bad).
How?
•   Rooster leverages 3 (optionally 4) excellent open source bits of
    software:

    •   EventMachine:  provides event-driven I/O using the Reactor
        pattern.  It lets you write network clients and servers without
        handling sockets.

    •   Rufus Scheduler:   a Ruby gem for scheduling pieces of
        code (can leverage EventMachine if available).

    •   daemons:  A Ruby gem that provides an easy way to wrap
        existing ruby code to be run as a daemon and to be controlled
        by simple start/stop/restart commands.   (I know we moved
        away from our previous daemons-based solution, but not all
        daemons are bad).

    •   Chronic (Optional) - A handy gem for natural language date/
        time parsing.
How?



•   These components fit together thusly:
How?


•   These components fit together thusly:

    •   The rooster daemon is started, and then kicks off the
        Rooster::Runner.
How?

•   These components fit together thusly:

    •   The rooster daemon is started, and then kicks off the
        Rooster::Runner.

    •   Rooster::Runner runs the main EventMachine reactor loop,
        loads a Rufus::Scheduler, loads (and optionally schedules)
        each rooster task, and starts the ControlServer.
How?

•   These components fit together thusly:

    •   The rooster daemon is started, and then kicks off the
        Rooster::Runner.

    •   Rooster::Runner runs the main EventMachine reactor loop,
        loads a Rufus::Scheduler, loads (and optionally schedules)
        each rooster task, and starts the ControlServer.

    •   Rooster::ControlServer is a TCP-based server that listens for
        Rooster control commands (e.g.  schedule, unschedule, exit,
        etc.).
How?
•   These components fit together thusly:

    •   The rooster daemon is started, and then kicks off the
        Rooster::Runner.

    •   Rooster::Runner runs the main EventMachine reactor loop,
        loads a Rufus::Scheduler, loads (and optionally schedules)
        each rooster task, and starts the ControlServer.

    •   Rooster::ControlServer is a TCP-based server that listens for
        Rooster control commands (e.g.  schedule, unschedule, exit,
        etc.).

    •   Rooster::ControlClient issues commands to the
        ControlServer; used mainly as a rake helper.
I kan haz A EXAMPLE Pleez?
Example
•   I want a task that kills all kittens at 4:20pm every day

•   > script/generate rooster_task KittenKiller

•   Generates a new templated task in:
    RAILS_ROOT/lib/rooster/tasks/kitten_killer_task.rb




•   rake rooster:launch
    (and then maybe `rake rooster:start TASK=KittenKillerTask`)
Commands


•   Tag-based commands are handy for controlling only a subset of
    available tasks

    •   For example, we have separate rooster tasks running on app1
        and app3, and are controlled with those server-specific tags.
Future Goals
•   Make rooster task scheduling blocks DRYer, especially by
    abstracting away the ActiveRecord connection pool cleanup.

•   Refactor Rooster::Runner (prettier code).

•   Add scripts (e.g. script/rooster daemon:start)

•   On daemon launch, autostart tasks having a certain tag (or
    accept a lambda, e.g.
    launch_if => lamba { |task| task.tags.include?(“app1”) } )
References
•   http://daemons.rubyforge.org/

•   http://github.com/jmettraux/rufus-scheduler/tree/master

•   http://rubyeventmachine.com/

•   http://github.com/findchris/rooster/tree/master
The Rooster Has Spoken
But wait, there’s more!
Single Slide: Create a Rails
 plugin and push to github
•   First, go to github.com, signup, add ssh keys, and create a new
    project

•   Then...

Más contenido relacionado

La actualidad más candente

Infrastructure & System Monitoring using Prometheus
Infrastructure & System Monitoring using PrometheusInfrastructure & System Monitoring using Prometheus
Infrastructure & System Monitoring using PrometheusMarco Pas
 
Spark Streaming Info
Spark Streaming InfoSpark Streaming Info
Spark Streaming InfoDoug Chang
 
Kafka Summit NYC 2017 - Running Hundreds of Kafka Clusters with 5 People
Kafka Summit NYC 2017 - Running Hundreds of Kafka Clusters with 5 PeopleKafka Summit NYC 2017 - Running Hundreds of Kafka Clusters with 5 People
Kafka Summit NYC 2017 - Running Hundreds of Kafka Clusters with 5 Peopleconfluent
 
Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...
Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...
Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...Puppet
 
Crash reports pycodeconf
Crash reports pycodeconfCrash reports pycodeconf
Crash reports pycodeconflauraxthomson
 
Reflection in Pharo5
Reflection in Pharo5Reflection in Pharo5
Reflection in Pharo5Marcus Denker
 
Distributed and concurrent programming with RabbitMQ and EventMachine Rails U...
Distributed and concurrent programming with RabbitMQ and EventMachine Rails U...Distributed and concurrent programming with RabbitMQ and EventMachine Rails U...
Distributed and concurrent programming with RabbitMQ and EventMachine Rails U...Paolo Negri
 
2010 vampir workshop_iu_configuration
2010 vampir workshop_iu_configuration2010 vampir workshop_iu_configuration
2010 vampir workshop_iu_configurationPTIHPA
 
Streaming and Messaging
Streaming and MessagingStreaming and Messaging
Streaming and MessagingXin Wang
 
Introduction to Systems Management with SaltStack
Introduction to Systems Management with SaltStackIntroduction to Systems Management with SaltStack
Introduction to Systems Management with SaltStackCraig Sebenik
 
Ractor's speed is not light-speed
Ractor's speed is not light-speedRactor's speed is not light-speed
Ractor's speed is not light-speedSATOSHI TAGOMORI
 
Let the alpakka pull your stream
Let the alpakka pull your streamLet the alpakka pull your stream
Let the alpakka pull your streamEnno Runne
 
How to Make MPI Awesome: A Proposal for MPI Sessions
How to Make MPI Awesome: A Proposal for MPI SessionsHow to Make MPI Awesome: A Proposal for MPI Sessions
How to Make MPI Awesome: A Proposal for MPI Sessionsinside-BigData.com
 
2010-02-09 Reactor Pattern & Event Driven Programming
2010-02-09 Reactor Pattern & Event Driven Programming2010-02-09 Reactor Pattern & Event Driven Programming
2010-02-09 Reactor Pattern & Event Driven ProgrammingLin Jen-Shin
 

La actualidad más candente (20)

Infrastructure & System Monitoring using Prometheus
Infrastructure & System Monitoring using PrometheusInfrastructure & System Monitoring using Prometheus
Infrastructure & System Monitoring using Prometheus
 
Spark Streaming Info
Spark Streaming InfoSpark Streaming Info
Spark Streaming Info
 
Kafka Summit NYC 2017 - Running Hundreds of Kafka Clusters with 5 People
Kafka Summit NYC 2017 - Running Hundreds of Kafka Clusters with 5 PeopleKafka Summit NYC 2017 - Running Hundreds of Kafka Clusters with 5 People
Kafka Summit NYC 2017 - Running Hundreds of Kafka Clusters with 5 People
 
Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...
Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...
Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...
 
Crash reports pycodeconf
Crash reports pycodeconfCrash reports pycodeconf
Crash reports pycodeconf
 
AMC Minor Technical Issues
AMC Minor Technical IssuesAMC Minor Technical Issues
AMC Minor Technical Issues
 
Reflection in Pharo5
Reflection in Pharo5Reflection in Pharo5
Reflection in Pharo5
 
Distributed and concurrent programming with RabbitMQ and EventMachine Rails U...
Distributed and concurrent programming with RabbitMQ and EventMachine Rails U...Distributed and concurrent programming with RabbitMQ and EventMachine Rails U...
Distributed and concurrent programming with RabbitMQ and EventMachine Rails U...
 
2010 vampir workshop_iu_configuration
2010 vampir workshop_iu_configuration2010 vampir workshop_iu_configuration
2010 vampir workshop_iu_configuration
 
Streaming and Messaging
Streaming and MessagingStreaming and Messaging
Streaming and Messaging
 
Java 8 concurrency abstractions
Java 8 concurrency abstractionsJava 8 concurrency abstractions
Java 8 concurrency abstractions
 
Apache samza
Apache samzaApache samza
Apache samza
 
Introduction to Systems Management with SaltStack
Introduction to Systems Management with SaltStackIntroduction to Systems Management with SaltStack
Introduction to Systems Management with SaltStack
 
Ractor's speed is not light-speed
Ractor's speed is not light-speedRactor's speed is not light-speed
Ractor's speed is not light-speed
 
Let the alpakka pull your stream
Let the alpakka pull your streamLet the alpakka pull your stream
Let the alpakka pull your stream
 
How to Make MPI Awesome: A Proposal for MPI Sessions
How to Make MPI Awesome: A Proposal for MPI SessionsHow to Make MPI Awesome: A Proposal for MPI Sessions
How to Make MPI Awesome: A Proposal for MPI Sessions
 
2010-02-09 Reactor Pattern & Event Driven Programming
2010-02-09 Reactor Pattern & Event Driven Programming2010-02-09 Reactor Pattern & Event Driven Programming
2010-02-09 Reactor Pattern & Event Driven Programming
 
Perl in Teh Cloud
Perl in Teh CloudPerl in Teh Cloud
Perl in Teh Cloud
 
HTTP/2 Server Push
HTTP/2 Server PushHTTP/2 Server Push
HTTP/2 Server Push
 
Async await...oh wait!
Async await...oh wait!Async await...oh wait!
Async await...oh wait!
 

Destacado

Examen metodo 2 da. unidad
Examen metodo 2 da. unidadExamen metodo 2 da. unidad
Examen metodo 2 da. unidadlaura
 
E:\Mis Documentos\Santiago\Cuarto Ciclo\ComunicacióN Eficas En El Medio Laboral
E:\Mis Documentos\Santiago\Cuarto Ciclo\ComunicacióN Eficas En El Medio LaboralE:\Mis Documentos\Santiago\Cuarto Ciclo\ComunicacióN Eficas En El Medio Laboral
E:\Mis Documentos\Santiago\Cuarto Ciclo\ComunicacióN Eficas En El Medio LaboralTecnológico Sudamericano
 
Commmpete por Diana Vinay
Commmpete por Diana VinayCommmpete por Diana Vinay
Commmpete por Diana Vinayguest6ef6a7
 
Блогирање на долги патеки
Блогирање на долги патекиБлогирање на долги патеки
Блогирање на долги патекиIva Dujak
 
InvestigacióN
InvestigacióNInvestigacióN
InvestigacióNyanniny
 
Current and future challenges of the poultry industry
Current and future challenges of the poultry industryCurrent and future challenges of the poultry industry
Current and future challenges of the poultry industrymithu mehr
 
Taller ggb práctica 4
Taller ggb  práctica 4Taller ggb  práctica 4
Taller ggb práctica 4Noemi Haponiuk
 
How to mellow the rage
How to mellow the rageHow to mellow the rage
How to mellow the ragearinave
 
La Tierra Chaleco 7 A 17 Y 24
La Tierra Chaleco 7 A 17 Y 24La Tierra Chaleco 7 A 17 Y 24
La Tierra Chaleco 7 A 17 Y 24vega95
 
Ieeepro techno solutions 2013 ieee embedded project dynamic traffic control...
Ieeepro techno solutions   2013 ieee embedded project dynamic traffic control...Ieeepro techno solutions   2013 ieee embedded project dynamic traffic control...
Ieeepro techno solutions 2013 ieee embedded project dynamic traffic control...srinivasanece7
 
Do you have any questions for me
Do you have any questions for meDo you have any questions for me
Do you have any questions for meEnglish Online Inc.
 
Universidad tecnica de amabato joha ntics
Universidad tecnica de amabato joha nticsUniversidad tecnica de amabato joha ntics
Universidad tecnica de amabato joha nticsjcaritoavila
 

Destacado (19)

Examen metodo 2 da. unidad
Examen metodo 2 da. unidadExamen metodo 2 da. unidad
Examen metodo 2 da. unidad
 
WTWE.
WTWE.WTWE.
WTWE.
 
E:\EstratificacióN DemográFica Y Social
E:\EstratificacióN DemográFica Y SocialE:\EstratificacióN DemográFica Y Social
E:\EstratificacióN DemográFica Y Social
 
Ejemplosss
EjemplosssEjemplosss
Ejemplosss
 
E:\Mis Documentos\Santiago\Cuarto Ciclo\ComunicacióN Eficas En El Medio Laboral
E:\Mis Documentos\Santiago\Cuarto Ciclo\ComunicacióN Eficas En El Medio LaboralE:\Mis Documentos\Santiago\Cuarto Ciclo\ComunicacióN Eficas En El Medio Laboral
E:\Mis Documentos\Santiago\Cuarto Ciclo\ComunicacióN Eficas En El Medio Laboral
 
Gestion
GestionGestion
Gestion
 
Commmpete por Diana Vinay
Commmpete por Diana VinayCommmpete por Diana Vinay
Commmpete por Diana Vinay
 
Блогирање на долги патеки
Блогирање на долги патекиБлогирање на долги патеки
Блогирање на долги патеки
 
InvestigacióN
InvestigacióNInvestigacióN
InvestigacióN
 
Current and future challenges of the poultry industry
Current and future challenges of the poultry industryCurrent and future challenges of the poultry industry
Current and future challenges of the poultry industry
 
Taller ggb práctica 4
Taller ggb  práctica 4Taller ggb  práctica 4
Taller ggb práctica 4
 
Mis apellidos.pptx
Mis apellidos.pptxMis apellidos.pptx
Mis apellidos.pptx
 
How to mellow the rage
How to mellow the rageHow to mellow the rage
How to mellow the rage
 
e-commerce
e-commercee-commerce
e-commerce
 
La Tierra Chaleco 7 A 17 Y 24
La Tierra Chaleco 7 A 17 Y 24La Tierra Chaleco 7 A 17 Y 24
La Tierra Chaleco 7 A 17 Y 24
 
Ieeepro techno solutions 2013 ieee embedded project dynamic traffic control...
Ieeepro techno solutions   2013 ieee embedded project dynamic traffic control...Ieeepro techno solutions   2013 ieee embedded project dynamic traffic control...
Ieeepro techno solutions 2013 ieee embedded project dynamic traffic control...
 
Do you have any questions for me
Do you have any questions for meDo you have any questions for me
Do you have any questions for me
 
Universidad tecnica de amabato joha ntics
Universidad tecnica de amabato joha nticsUniversidad tecnica de amabato joha ntics
Universidad tecnica de amabato joha ntics
 
4 marginal cost
4 marginal cost4 marginal cost
4 marginal cost
 

Similar a Rooster Tech Talk

Large-scaled Deploy Over 100 Servers in 3 Minutes
Large-scaled Deploy Over 100 Servers in 3 MinutesLarge-scaled Deploy Over 100 Servers in 3 Minutes
Large-scaled Deploy Over 100 Servers in 3 MinutesHiroshi SHIBATA
 
Hot to build continuously processing for 24/7 real-time data streaming platform?
Hot to build continuously processing for 24/7 real-time data streaming platform?Hot to build continuously processing for 24/7 real-time data streaming platform?
Hot to build continuously processing for 24/7 real-time data streaming platform?GetInData
 
Real time system_performance_mon
Real time system_performance_monReal time system_performance_mon
Real time system_performance_monTomas Doran
 
Cooking a rabbit pie
Cooking a rabbit pieCooking a rabbit pie
Cooking a rabbit pieTomas Doran
 
Webinar: Queues with RabbitMQ - Lorna Mitchell
Webinar: Queues with RabbitMQ - Lorna MitchellWebinar: Queues with RabbitMQ - Lorna Mitchell
Webinar: Queues with RabbitMQ - Lorna MitchellCodemotion
 
Introduction to Laravel Framework (5.2)
Introduction to Laravel Framework (5.2)Introduction to Laravel Framework (5.2)
Introduction to Laravel Framework (5.2)Viral Solani
 
Lotuscript for large systems
Lotuscript for large systemsLotuscript for large systems
Lotuscript for large systemsBill Buchan
 
Puppet Camp NYC 2014: Build a Modern Infrastructure in 45 min!
Puppet Camp NYC 2014: Build a Modern Infrastructure in 45 min!Puppet Camp NYC 2014: Build a Modern Infrastructure in 45 min!
Puppet Camp NYC 2014: Build a Modern Infrastructure in 45 min!Puppet
 
Deployment of WebObjects applications on CentOS Linux
Deployment of WebObjects applications on CentOS LinuxDeployment of WebObjects applications on CentOS Linux
Deployment of WebObjects applications on CentOS LinuxWO Community
 
Common Pitfalls of Functional Programming and How to Avoid Them: A Mobile Gam...
Common Pitfalls of Functional Programming and How to Avoid Them: A Mobile Gam...Common Pitfalls of Functional Programming and How to Avoid Them: A Mobile Gam...
Common Pitfalls of Functional Programming and How to Avoid Them: A Mobile Gam...gree_tech
 
Black hat dc-2010-egypt-uav-slides
Black hat dc-2010-egypt-uav-slidesBlack hat dc-2010-egypt-uav-slides
Black hat dc-2010-egypt-uav-slidesBakry3
 
Distributed app development with nodejs and zeromq
Distributed app development with nodejs and zeromqDistributed app development with nodejs and zeromq
Distributed app development with nodejs and zeromqRuben Tan
 
Building Hermetic Systems (without Docker)
Building Hermetic Systems (without Docker)Building Hermetic Systems (without Docker)
Building Hermetic Systems (without Docker)William Farrell
 
Writing Asynchronous Programs with Scala & Akka
Writing Asynchronous Programs with Scala & AkkaWriting Asynchronous Programs with Scala & Akka
Writing Asynchronous Programs with Scala & AkkaYardena Meymann
 
Puppet Camp New York 2014: Streamlining Puppet Development Workflow
Puppet Camp New York 2014: Streamlining Puppet Development Workflow Puppet Camp New York 2014: Streamlining Puppet Development Workflow
Puppet Camp New York 2014: Streamlining Puppet Development Workflow Puppet
 

Similar a Rooster Tech Talk (20)

Large-scaled Deploy Over 100 Servers in 3 Minutes
Large-scaled Deploy Over 100 Servers in 3 MinutesLarge-scaled Deploy Over 100 Servers in 3 Minutes
Large-scaled Deploy Over 100 Servers in 3 Minutes
 
Hot to build continuously processing for 24/7 real-time data streaming platform?
Hot to build continuously processing for 24/7 real-time data streaming platform?Hot to build continuously processing for 24/7 real-time data streaming platform?
Hot to build continuously processing for 24/7 real-time data streaming platform?
 
Ansible - A 'crowd' introduction
Ansible - A 'crowd' introductionAnsible - A 'crowd' introduction
Ansible - A 'crowd' introduction
 
Real time system_performance_mon
Real time system_performance_monReal time system_performance_mon
Real time system_performance_mon
 
Cooking a rabbit pie
Cooking a rabbit pieCooking a rabbit pie
Cooking a rabbit pie
 
Webinar: Queues with RabbitMQ - Lorna Mitchell
Webinar: Queues with RabbitMQ - Lorna MitchellWebinar: Queues with RabbitMQ - Lorna Mitchell
Webinar: Queues with RabbitMQ - Lorna Mitchell
 
Introduction to Laravel Framework (5.2)
Introduction to Laravel Framework (5.2)Introduction to Laravel Framework (5.2)
Introduction to Laravel Framework (5.2)
 
Automation in Cloud
Automation in CloudAutomation in Cloud
Automation in Cloud
 
Lotuscript for large systems
Lotuscript for large systemsLotuscript for large systems
Lotuscript for large systems
 
Puppet Camp NYC 2014: Build a Modern Infrastructure in 45 min!
Puppet Camp NYC 2014: Build a Modern Infrastructure in 45 min!Puppet Camp NYC 2014: Build a Modern Infrastructure in 45 min!
Puppet Camp NYC 2014: Build a Modern Infrastructure in 45 min!
 
Daemons
DaemonsDaemons
Daemons
 
Wielding a cortana
Wielding a cortanaWielding a cortana
Wielding a cortana
 
Deployment of WebObjects applications on CentOS Linux
Deployment of WebObjects applications on CentOS LinuxDeployment of WebObjects applications on CentOS Linux
Deployment of WebObjects applications on CentOS Linux
 
Common Pitfalls of Functional Programming and How to Avoid Them: A Mobile Gam...
Common Pitfalls of Functional Programming and How to Avoid Them: A Mobile Gam...Common Pitfalls of Functional Programming and How to Avoid Them: A Mobile Gam...
Common Pitfalls of Functional Programming and How to Avoid Them: A Mobile Gam...
 
Black hat dc-2010-egypt-uav-slides
Black hat dc-2010-egypt-uav-slidesBlack hat dc-2010-egypt-uav-slides
Black hat dc-2010-egypt-uav-slides
 
Distributed app development with nodejs and zeromq
Distributed app development with nodejs and zeromqDistributed app development with nodejs and zeromq
Distributed app development with nodejs and zeromq
 
Infrastructure as Code
Infrastructure as CodeInfrastructure as Code
Infrastructure as Code
 
Building Hermetic Systems (without Docker)
Building Hermetic Systems (without Docker)Building Hermetic Systems (without Docker)
Building Hermetic Systems (without Docker)
 
Writing Asynchronous Programs with Scala & Akka
Writing Asynchronous Programs with Scala & AkkaWriting Asynchronous Programs with Scala & Akka
Writing Asynchronous Programs with Scala & Akka
 
Puppet Camp New York 2014: Streamlining Puppet Development Workflow
Puppet Camp New York 2014: Streamlining Puppet Development Workflow Puppet Camp New York 2014: Streamlining Puppet Development Workflow
Puppet Camp New York 2014: Streamlining Puppet Development Workflow
 

Último

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 

Último (20)

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 

Rooster Tech Talk

  • 2. Rooster • It does the same thing everyday at the same time, whether you are sleeping or not
  • 3. Rooster • Designed to run periodic tasks, on schedule
  • 4. History • Previously we used the daemons gem plus the daemon generator plugin. • Headaches: • Each daemon is a separate process. • Not very DRY:
  • 5. Not DRY • Each daemon has two files: • The actual code that runs as a daemon (e.g. network_point_update_daemon.rb) •
  • 6. Not DRY • Each daemon has two files: • And a daemon control script (e.g. network_point_update_daemon_ctl) •
  • 7. Not DRY • The only bit of code that actually does our work: AppUser.daily_amount_grant • The Rails environment is loaded within each daemon process! Not good for memory. • No centralized logging/error handling; poignantly recognized when we wanted exceptions emailed to us. • Management of each daemon process required another entry into monit's config file (eww!):
  • 8. Back To The Future (of scheduled tasks)
  • 11. Rooster What does it do? Scratches the itches of our previous configuration
  • 12. Rooster It’s DRY • One daemon, monitored by monit • One Rails environment, loaded once • Easier management:  TCP server (easily accessed by telnet), rake tasks, more to come... • Centralized and configurable error handling and logging: Rooster::Runner.error_handler = lambda { |e| HoptoadNotifier.notify(e) }
  • 13. How? • Rooster leverages 3 (optionally 4) excellent open source bits of software:
  • 14. How? • Rooster leverages 3 (optionally 4) excellent open source bits of software: • EventMachine:  provides event-driven I/O using the Reactor pattern.  It lets you write network clients and servers without handling sockets.
  • 15. How? • Rooster leverages 3 (optionally 4) excellent open source bits of software: • EventMachine:  provides event-driven I/O using the Reactor pattern.  It lets you write network clients and servers without handling sockets. • Rufus Scheduler:   a Ruby gem for scheduling pieces of code (can leverage EventMachine if available).
  • 16. How? • Rooster leverages 3 (optionally 4) excellent open source bits of software: • EventMachine:  provides event-driven I/O using the Reactor pattern.  It lets you write network clients and servers without handling sockets. • Rufus Scheduler:   a Ruby gem for scheduling pieces of code (can leverage EventMachine if available). • daemons:  A Ruby gem that provides an easy way to wrap existing ruby code to be run as a daemon, and to be controlled by simple start/stop/restart commands.   (I know we moved away from our previous daemons-based solution, but not all daemons are bad).
  • 17. How? • Rooster leverages 3 (optionally 4) excellent open source bits of software: • EventMachine:  provides event-driven I/O using the Reactor pattern.  It lets you write network clients and servers without handling sockets. • Rufus Scheduler:   a Ruby gem for scheduling pieces of code (can leverage EventMachine if available). • daemons:  A Ruby gem that provides an easy way to wrap existing ruby code to be run as a daemon and to be controlled by simple start/stop/restart commands.   (I know we moved away from our previous daemons-based solution, but not all daemons are bad). • Chronic (Optional) - A handy gem for natural language date/ time parsing.
  • 18. How? • These components fit together thusly:
  • 19. How? • These components fit together thusly: • The rooster daemon is started, and then kicks off the Rooster::Runner.
  • 20. How? • These components fit together thusly: • The rooster daemon is started, and then kicks off the Rooster::Runner. • Rooster::Runner runs the main EventMachine reactor loop, loads a Rufus::Scheduler, loads (and optionally schedules) each rooster task, and starts the ControlServer.
  • 21. How? • These components fit together thusly: • The rooster daemon is started, and then kicks off the Rooster::Runner. • Rooster::Runner runs the main EventMachine reactor loop, loads a Rufus::Scheduler, loads (and optionally schedules) each rooster task, and starts the ControlServer. • Rooster::ControlServer is a TCP-based server that listens for Rooster control commands (e.g.  schedule, unschedule, exit, etc.).
  • 22. How? • These components fit together thusly: • The rooster daemon is started, and then kicks off the Rooster::Runner. • Rooster::Runner runs the main EventMachine reactor loop, loads a Rufus::Scheduler, loads (and optionally schedules) each rooster task, and starts the ControlServer. • Rooster::ControlServer is a TCP-based server that listens for Rooster control commands (e.g.  schedule, unschedule, exit, etc.). • Rooster::ControlClient issues commands to the ControlServer; used mainly as a rake helper.
  • 23. I kan haz A EXAMPLE Pleez?
  • 24. Example • I want a task that kills all kittens at 4:20pm every day • > script/generate rooster_task KittenKiller • Generates a new templated task in: RAILS_ROOT/lib/rooster/tasks/kitten_killer_task.rb • rake rooster:launch (and then maybe `rake rooster:start TASK=KittenKillerTask`)
  • 25. Commands • Tag-based commands are handy for controlling only a subset of available tasks • For example, we have separate rooster tasks running on app1 and app3, and are controlled with those server-specific tags.
  • 26. Future Goals • Make rooster task scheduling blocks DRYer, especially by abstracting away the ActiveRecord connection pool cleanup. • Refactor Rooster::Runner (prettier code). • Add scripts (e.g. script/rooster daemon:start) • On daemon launch, autostart tasks having a certain tag (or accept a lambda, e.g. launch_if => lamba { |task| task.tags.include?(“app1”) } )
  • 27. References • http://daemons.rubyforge.org/ • http://github.com/jmettraux/rufus-scheduler/tree/master • http://rubyeventmachine.com/ • http://github.com/findchris/rooster/tree/master
  • 28. The Rooster Has Spoken
  • 30. Single Slide: Create a Rails plugin and push to github • First, go to github.com, signup, add ssh keys, and create a new project • Then...