Skip to content

Latest commit

 

History

History
77 lines (53 loc) · 3.85 KB

README.md

File metadata and controls

77 lines (53 loc) · 3.85 KB

Python 2.6 2.7 3.7 Build Status Code style: black Linting

Shotgun Event Framework

This software was originaly developed by Patrick Boucher with support from Rodeo Fx and Oblique. It is now part of Shotgun Software's open source initiative.

This software is provided under the MIT License that can be found in the LICENSE file or at the Open Source Initiative website.

Overview

When you want to access the Shotgun event stream, the preferred way to do so it to monitor the events table, get any new events, process them and repeat.

A lot of stuff is required for this process to work successfully, stuff that may not have any direct bearing on the business rules that need to be applied.

The role of the framework is to keep any tedious monitoring tasks out of the hands of the business logic implementor.

The framework is a daemon process that runs on a server and monitors the Shotgun event stream. When events are found, the daemon hands the events out to a series of registered plugins. Each plugin can process the event as it wishes.

The daemon handles:

  • Registering plugins from one or more specified paths.
  • Deactivate any crashing plugins.
  • Reloading plugins when they change on disk.
  • Monitoring the Shotgun event stream.
  • Remembering the last processed event id and any backlog.
  • Starting from the last processed event id on daemon startup.
  • Catching any connection errors.
  • Logging information to stdout, file or email as required.
  • Creating a connection to Shotgun that will be used by the callback.
  • Handing off events to registered callbacks.

A plugin handles:

  • Registering any number of callbacks into the framework.
  • Processing a single event when one is provided by the framework.

Advantages of the framework

  • Only deal with a single monitoring mechanism for all scripts, not one per script.
  • Minimize network and database load (only one monitor that supplies event to many event processing plugins).

Documentation

See the GitHub Wiki.

Using Docker

This is a first draft at packaging up the daemon with docker.

Right now you need to edit the src/shotgunEventDaemon.conf file and enter your values. This file will be copied to the image during the Docker build process. Further work would be needed to generate this config more flexibly. Be weary that some values from the config should not be edited (like the plugin and log locations) as these will be mapped from the container to your host. Look for notes to this effect in the .conf file.

The general steps to get you going are as follows:

  • Clone this repository to your local computer
  • Edit your .conf file in place
  • Change directory to the top level of the the Github clone
  • Build your docker image with docker build -t shotgun-events .
  • Run your daemon with docker run -d --restart unless-stopped --name="shotgun-events" -v `pwd`/logs:/var/log/shotgunEventDaemon -v `pwd`/plugins:/root/shotgunEventDaemon/plugins shotgun-events

The logArgs.py plugin comes pre-installed in the plugin directory. Don't forget to generate a script key for the plugin and enter that information in the reg.registerCallback call for proper authentication of the plugin to your site.