Drivers

Zuul provides an API for extending its functionality to interact with other systems.

class zuul.driver.Driver

A Driver is an extension component of Zuul that supports interfacing with a remote system. It can support any of the following interfaces (but must support at least one to be useful):

  • ConnectionInterface
  • SourceInterface
  • TriggerInterface
  • ReporterInterface

Zuul will create a single instance of each Driver (which will be shared by all tenants), and this instance will persist for the life of the process. The Driver class may therefore manage any global state used by all connections.

The class or instance attribute name must be provided as a string.

reconfigure(tenant)

Called when a tenant is reconfigured.

This method is optional; the base implementation does nothing.

When Zuul performs a reconfiguration for a tenant, this method is called with the tenant (including the new layout configuration) as an argument. The driver may establish any global resources needed by the tenant at this point.

Parameters:tenant (Tenant) – The zuul.model.Tenant which has been reconfigured.
registerScheduler(scheduler)

Register the scheduler with the driver.

This method is optional; the base implementation does nothing.

This method is called once during initialization to allow the driver to store a handle to the running scheduler.

Parameters:scheduler (Scheduler) – The current running zuul.scheduler.Scheduler.
stop()

Stop the driver from running.

This method is optional; the base implementation does nothing.

This method is called when the connection registry is stopped allowing you additionally stop any running Driver computation not specific to a connection.

class zuul.driver.ConnectionInterface

The Connection interface.

A driver which is able to supply a Connection should implement this interface.

getConnection(name, config)

Create and return a new Connection object.

This method is required by the interface.

This method will be called once for each connection specified in zuul.conf. The resultant object should be responsible for establishing any long-lived connections to remote systems. If Zuul is reconfigured, all existing connections will be stopped and this method will be called again for any new connections which should be created.

When a connection is specified in zuul.conf with a name, that name is used here when creating the connection, and it is also used in the layout to attach triggers and reporters to the named connection. If the Driver does not utilize a connection (because it does not interact with a remote system), do not implement this method and Zuul will automatically associate triggers and reporters with the name of the Driver itself where it would normally expect the name of a connection.

Parameters:
  • name (str) – The name of the connection. This is the name supplied in the zuul.conf file where the connection is configured.
  • config (dict) – The configuration information supplied along with the connection in zuul.conf.
Returns:

A new Connection object.

Return type:

Connection

class zuul.driver.SourceInterface

The source interface to be implemented by a driver.

A driver which is able to supply a Source should implement this interface.

getRejectSchema()

Get the schema for this driver’s pipeline reject filter.

This method is required by the interface.

Returns:A voluptuous schema.
Return type:dict or Schema
getRequireSchema()

Get the schema for this driver’s pipeline requirement filter.

This method is required by the interface.

Returns:A voluptuous schema.
Return type:dict or Schema
getSource(connection)

Create and return a new Source object.

This method is required by the interface.

Parameters:connection (Connection) – The Connection object associated with the source (as previously returned by getConnection).
Returns:A new Source object.
Return type:Source
class zuul.driver.TriggerInterface

The trigger interface.

A driver which is able to supply a trigger should implement this interface.

getTrigger(connection, config=None)

Create and return a new trigger object.

This method is required by the interface.

The trigger object returned should inherit from the BaseTrigger class.

Parameters:
  • connection (Connection) – The Connection object associated with the trigger (as previously returned by getConnection) or None.
  • config (dict) – The configuration information supplied along with the trigger in the layout.
Returns:

A new trigger object.

Return type:

BaseTrigger

getTriggerSchema()

Get the schema for this driver’s trigger.

This method is required by the interface.

Returns:A voluptuous schema.
Return type:dict or Schema
class zuul.driver.ReporterInterface

The reporter interface to be implemented by a driver.

A driver which is able to supply a Reporter should implement this interface.

getReporter(connection, config=None)

Create and return a new Reporter object.

This method is required by the interface.

Parameters:
  • connection (Connection) – The Connection object associated with the reporter (as previously returned by getConnection) or None.
  • config (dict) – The configuration information supplied along with the reporter in the layout.
Returns:

A new Reporter object.

Return type:

Reporter

getReporterSchema()

Get the schema for this driver’s reporter.

This method is required by the interface.

Returns:A voluptuous schema.
Return type:dict or Schema