DEV Community

Alexey Melezhik
Alexey Melezhik

Posted on

2 2

Sparrowdo - Ubiquitous Asynchronous Task Runner ( with Nice Frontend )

In the latest version of Sparrowdo I've improved "hosts" API allows one to define multiple tasks configurations using Raku Hashes and Arrays:

$ nano hosts.raku

[
  %( 
     host => "localhost",
     name => "task1",
     tags => %(
       param1 => "val1",
       param2 => "val2",
     )
  ),
  %( 
     host => "localhost",
     name => "task2",
     tags => %(
       param1 => "val1",
       param2 => "val2",
     )
  ),
]
Enter fullscreen mode Exit fullscreen mode

This trivial example defines 2 tasks get run with some specific parameters. To run these task we should to define a Sparrowdo scenario:

$ nano sparrowfile


say "you've passed me:";
say tags()<param1>;
say tags()<param2>;

# other task specific logic here

if tags()<name> eq "task1" {
 # ...
} elsif tags()<name> eq "task1" {
 # ...
}

Enter fullscreen mode Exit fullscreen mode

And run it:

$ sparrowdo --host=hosts.raku --sparrowfile=sparrowdo

Sparrowdo will put 2 tasks into a Sparky queue so that Sparky will handle them later in asynchronous way.

To track tasks statuses and reports - go to Sparky frontend - http://127.0.0.1:3000.

You can override some parameters using command line:

$ sparrowdo --host=hosts.raku --sparrowfile=sparrowdo --tags=param1=value100


Sparrowdo is all battery included Sparrow plugins and DSL one could use in their daily tasks:

$ nano hosts.raku

[
   %( 
     host => "192.168.0.1",
     tags => ["frontend","prod"]
   ),
   %( 
     host => "192.168.0.2",
     tags => ["backend","prod"]
   ),
]
Enter fullscreen mode Exit fullscreen mode

$ nano sparrowfile


if tags()<frontend> {
   package-install "nginx"
} elsif tags()<backend> {
   package-install "java"
} 
Enter fullscreen mode Exit fullscreen mode

Thanks for reading.

Alexey

đź‘‹ While you are here

Reinvent your career. Join DEV.

It takes one minute and is worth it for your career.

Get started

Top comments (0)

đź‘‹ Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay