Python raven.fetch_git_sha() Examples

The following are 3 code examples of raven.fetch_git_sha(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module raven , or try the search function .
Example #1
Source File: worker.py    From greed with GNU Affero General Public License v3.0 5 votes vote down vote up
def __init__(self, bot: utils.DuckBot, chat: telegram.Chat, telegram_user: telegram.User, *args, **kwargs):
        # Initialize the thread
        super().__init__(name=f"Worker {chat.id}", *args, **kwargs)
        # Store the bot and chat info inside the class
        self.bot: utils.DuckBot = bot
        self.chat: telegram.Chat = chat
        self.telegram_user: telegram.User = telegram_user
        # Open a new database session
        log.debug(f"Opening new database session for {self.name}")
        self.session = db.Session()
        # Get the user db data from the users and admin tables
        self.user: Optional[db.User] = None
        self.admin: Optional[db.Admin] = None
        # The sending pipe is stored in the Worker class, allowing the forwarding of messages to the chat process
        self.queue = queuem.Queue()
        # The current active invoice payload; reject all invoices with a different payload
        self.invoice_payload = None
        # The localization strings for this user
        self.loc = None
        # The Sentry client for reporting errors encountered by the user
        if configloader.config["Error Reporting"]["sentry_token"] != \
                "https://00000000000000000000000000000000:00000000000000000000000000000000@sentry.io/0000000":
            import raven
            self.sentry_client = raven.Client(configloader.config["Error Reporting"]["sentry_token"],
                                              release=raven.fetch_git_sha(os.path.dirname(__file__)),
                                              environment="Dev" if __debug__ else "Prod")
            log.debug("Sentry: enabled")
        else:
            self.sentry_client = None
            log.debug("Sentry: disabled") 
Example #2
Source File: config.py    From nomad with Apache License 2.0 5 votes vote down vote up
def get_git_sha():
    try:
        return raven.fetch_git_sha(os.path.dirname(os.path.dirname(__file__)))
    except Exception as e:
        print(e)
        pass
    return os.environ.get('HEROKU_SLUG_COMMIT') 
Example #3
Source File: celery.py    From product-database with MIT License 5 votes vote down vote up
def on_configure(self):
        if settings.PDB_SENTRY_DSN:  # ignore for coverage
            client = raven.Client(settings.PDB_SENTRY_DSN)
            client.release = raven.fetch_git_sha(os.path.dirname(os.pardir))

            # register a custom filter to filter out duplicate logs
            register_logger_signal(client)

            # hook into the Celery error handler
            register_signal(client)