DEV Community

Cover image for Cromtit - Asynchronous Cron Jobs Runner and More
Alexey Melezhik
Alexey Melezhik

Posted on

Cromtit - Asynchronous Cron Jobs Runner and More

TL;DR

See "Why?" section


Right after Raku 2022 online conference, where I presented Tomtit, an idea came into my mind.

What if combine Tomtit with cron jobs? This is how Cromtit was born ...


So, meet Cromtit - asynchronous cron job runner for Tomtit projects:

In nutshell if one has many Tomtit projects, they might run them as cron or manual jobs using Sparky asynchronous jobs engine.

Quick start

Install

zef install --/test Cromtit 
Enter fullscreen mode Exit fullscreen mode

Step one

Define Cromtit configuration to describe all possible jobs:

projects:
  rakudo:
    path: ~/projects/rakudo
  r3:
    path: ~/projects/r3tool
    crontab: "30 * * * *"
    action: html-report
    options: --no_index_update
    before:
      -
        name: rakudo
        action: pull install 
Enter fullscreen mode Exit fullscreen mode

Here we define one main project - "R3" that runs blackbox tests for Rakudo built from the new commits. Before this job is triggered, a dependency job - "Rakudo" gets executed - ensure that a new commit is checked out and a fresh Rakudo is built, installed and ready to test.

Step two

Apply configuration:

cromt
Enter fullscreen mode Exit fullscreen mode

This step will convert Cromtit configuration into Sparky scenarios and Sparky will do it's job:

  • Ensure that project "R3" will be executed every halve hour

  • Reports and logs are accessible via Sparky web interface: http://127.0.0.1:4000

More

Of course this is very informal intro into Cromtit, one can get more details on documentation pages - https://github.com/melezhik/Cromtit

To spur more interest - some things to highlight. Cromtit allows:

  • Nested job dependencies, where job A is dependent on job B and job B is dependent on job C and so on.

  • Passing environment variables to jobs calls, so the same job could be called many times with different input parameters

  • Manual job runs instead of cron style runs

Why?

You have a lot of local projects that you want to run as cron jobs, but without standard linux cron complexity and with some features like job dependencies and html reports.


That is it. Thanks for reading, comments and questions are always appreciated.

Top comments (0)