def run():
    last_flash = time.time() - 500
    count = 0
    running = True
    while running:
        try:
            pid = open('ingest.pid').read()
            if str(pid) != str(os.getpid()):
                print 'Other ingest process %s detected not %s, exiting' % (pid, os.getpid())
                sys.exit(2)
        except IOError:
            print 'Ingest process exiting: ingest.pid file cound not be read'
            sys.exit(3)
        except:
            traceback.print_exc()
            sys.exit(4)
        for state in ('new', 'downloaded', 'parsed'):
            for t in get_tickets(state):
                determine_action(t)
                count += 1
        time.sleep(15)
        if last_flash - time.time() > (5 * 60):
            sys.stdout.write('Ingest pipeline %s %s performed %s actions\n' % (os.getpid(), time.ctime(), count))
            last_flash = time.time()
dataset/ETHPy150Open okfn/bibserver/bibserver/ingest.py/run/swapped operands of `-`