Utilities

exception sir.util.SIR_EXIT[source]

Bases: exceptions.Exception

exception sir.util.VersionMismatchException(core, expected, actual)[source]

Bases: exceptions.Exception

sir.util.check_solr_cores_version(cores)[source]

Checks multiple Solr cores for version compatibility

Parameters:cores ([str]) – The names of the cores
Raises:sir.util.VersionMismatchException – If the version in Solr is different from the supported one
sir.util.create_amqp_connection()[source]

Creates a connection to an AMQP server.

Return type:amqp.connection.Connection
sir.util.db_session()[source]

Creates a new sqlalchemy.orm.session.sessionmaker.

Return type:sqlalchemy.orm.session.sessionmaker
sir.util.db_session_ctx(*args, **kwds)[source]

A context manager yielding a database session.

Parameters:Session (sqlalchemy.orm.session.sessionmaker) –
sir.util.solr_connection(core)[source]

Creates a solr.Solr connection for the core core.

Parameters:core (str) –
Raises:urllib2.URLError – if a ping to the cores ping handler doesn’t succeed
Return type:solr.Solr
sir.util.solr_version_check(core)[source]

Checks that the version of the Solr core core matches the one in the schema.

Parameters:

core (str) –

Raises: