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
# (C)2015 # Scott Ernst from __future__ import print_function, absolute_import, unicode_literals, division from pyglass.app.PyGlassEnvironment import PyGlassEnvironment PyGlassEnvironment.initializeFromInternalPath(__file__) from cadence.data.TrackLinkConnector import TrackLinkConnector from cadence.models.analysis.Analysis_Track import Analysis_Track from cadence.models.tracks.Tracks_Track import Tracks_Track #################################################################################################### # INITIALIZATION VARIABLES model = Tracks_Track.MASTER session = model.createSession() analysisSession = Analysis_Track.createSession() tracks = session.query(model).filter(model.site == 'SCR').filter(model.level == '1030').all() linker = TrackLinkConnector() linker.run(tracks, session) for track in tracks: print('[LINKED]: %s' % track.fingerprint) session.commit() session.close() print('Track linking complete')