Skip to content

Instantly share code, notes, and snippets.

@amcgregor
Created December 6, 2011 16:02
Show Gist options
  • Save amcgregor/1438706 to your computer and use it in GitHub Desktop.
Save amcgregor/1438706 to your computer and use it in GitHub Desktop.
A high-level overview of Marrow Automaton.

Marrow Automaton

automaton |ôˈtämətən, -ˌtän|

noun ( pl. automata |-tə| or automatons ) — a moving mechanical device made in imitation of a human being.

  • A machine that performs a function according to a predetermined set of coded instructions, esp. one capable of a range of programmed responses to different circumstances.
  • A scripting infrastructure for project and system management.

Overview

Automaton is capable of performing a wide variety of tasks, with and without a web-based interface. Some examples include:

  • Remote server administration. If you have a cluster of servers you can use Automaton to parallelize command execution across a network, perform reporting, maintenance, and deployment.
  • Continuous integration. Attached with a post-commit hook in any modern SCM system, Automaton can perform actions such as automatically running tests, generating reports, and performing actions based on the result of testing such as e-mail notification and recording in a database for web-based view.
  • Deployment. Your application may require specific applications, librarires, etc. and, similar to buildout, Automaton can be used for recipe-based developemnt and production environment configuration.
  • Make replacement. Had to be said.

The commonality between these systems (which are covered by software such as buildout, buildbot, jenkins, and fabric, amongst others) is that they are all forms of automation or “batch scripting”. As such, Automaton is comprised of three main parts:

  • Plugin host and command line interface. The auto command provides a simple interface for executing Automaton scripts both interactively and as triggered events from other systems.
  • Recipe plugins. Automaton includes most everything you would need for the above described tasks, however, everyone’s use cases are unique. The plugin architecture allows you to easily bundle your own plugins, install them from the Package Index, etc.
  • Task-specific web-based applications. Some of these tasks benefit from a web-based interface for examiniation of execution history. This is especially important for “headless” or automated tasks such as continuous integration. These are written as WebCore web applications with customizeable themes.

Recipe Categories

Automaton plugins, called recipes, are grouped into several categories:

  • Actions, well, perform some action. Examples include: create a virtual environment, install a package, create a file or folder, etc.
  • Blueprints define a template-based directory and file structure, including variable replacement.
  • Contexts provide environments for the execution of other recipes. Examples include: on this server cluster, within the given virtual environment, etc.
  • Reporting recipes include methods of configuring and capturing log output, sending e-mail, and saving data into a database.

Sample Usage

Project Management

At the top level of your project create an Automaton.py file. This file contains the rules (as decorated functions) that mimic the behaviour of Make, allowing you to do things like:

  • auto — Execute the default action, usually preparing the environment for development of your software.
  • auto release — Perform actions necessary for a release of a package. Run tests, increment version numbers, tag in the SCM, register and upload compiled packages, etc.
  • auto deploy — As per release, but also connect to remote server clusters and perform actions there.

Server Maintenance

Similar to the Project Management example, you could use Automaton for server maintenance:

  • auto check — Perform a deeper analysis of cluster state than monitoring tools give.
  • auto update — Connect to the cluster master, pull updates, run tests, then push to the cluster slaves.
  • auto create — Create a new client or user on the cluster.
  • auto remove — The reverse of the previous item.

Continuous Integration

With auto -i/path/to/Automaton.py build --role=scheduled in cron, running at 9am and 6pm, and that script additionally run as a post-commit hook (with the role of post instead). Additionally, running auto -i/path/to/Automaton.py serve to serve the web application for perusal of build state and history.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment