def main(): utils.setup_logging() gh_pr.monkeypatch_github() if config.FLUSH_REDIS_ON_STARTUP: utils.get_redis().flushall() with rq.Connection(utils.get_redis()): worker = rq.worker.HerokuWorker([rq.Queue('default')], exception_handlers=[error_handler]) worker.work()
def main(): utils.setup_logging() config.log() gh_pr.monkeypatch_github() if config.FLUSH_REDIS_ON_STARTUP: utils.get_redis().flushall() with rq.Connection(utils.get_redis()): worker = rq.Worker(['default']) worker.work()
def __init__(self, g, installation_id, user, repo): self._redis = utils.get_redis() self._g = g self._installation_id = installation_id self._updater_token = self._redis.get("installation-token-%s" % self._installation_id) self._u = user self._r = repo
def __init__(self, g, user, repo): self._g = g self._u = user self._r = repo self._redis = utils.get_redis()
def get_redis(): if not hasattr(flask.g, 'redis'): conn = utils.get_redis() flask.g.redis = conn return flask.g.redis
# Copyright © 2017 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import sys import lz4 from pastamaker import utils owner, _, left = sys.argv[1].partition("/") repo, _, branch = left.partition("/") key = "queues~%s~%s~%s" % (owner, repo, branch) data = utils.get_redis().get(key) if data: print(lz4.block.decompress(data)) else: print("no cache")