def _runImpl(self): model = Tracks_Track.MASTER session = self._session if self._session else model.createSession() try: tlc = TrackLinkConnector(logger=self._log) self._log.write(u'<h1>Beginning Linkage Reset...</h1>') if self._tracks is not None: tlc.run(self._tracks, session) else: tlc.runAll(session) except Exception as err: if not self._session: session.close() self._log.writeError(u'Track linkage update failed', err) return 1 if not self._session: session.commit() session.close() return 0
from pyglass.app.PyGlassEnvironment import PyGlassEnvironment PyGlassEnvironment.initializeFromInternalPath(__file__) from cadence.data.TrackLinkConnector import TrackLinkConnector from cadence.models.tracks.Tracks_Track import Tracks_Track linker = TrackLinkConnector() session = Tracks_Track.MASTER.getSession() linker.runAll(session) print '--- RESULTS ---' print linker.echoResult() session.commit() session.close()