def setup_sentry(dsn, integrations=[]): logging_integration = LoggingIntegration( # Default behaviour: INFO messages will be included as breadcrumbs level=logging.INFO, # Change default behaviour (ERROR messages events) event_level=logging.WARNING, ) sentry_sdk.init( dsn=dsn, integrations=[logging_integration] + integrations, release=get_bugbug_version(), )
API_TOKEN = "X-Api-Key" API_DESCRIPTION = """ This is the documentation for the BubBug http service, the platform for Bugzilla Machine Learning projects. # Introduction This service can be used to classify a given bug using a pre-trained model. You can classify a single bug or a batch of bugs. The classification happens in the background so you need to call back the service for getting the results. """ spec = APISpec( title="Bugbug", version=get_bugbug_version(), openapi_version="3.0.2", info=dict(description=API_DESCRIPTION), plugins=[FlaskPlugin(), MarshmallowPlugin()], security=[{"api_key": []}], ) application = Flask(__name__) redis_url = os.environ.get("REDIS_URL", "redis://localhost/0") redis_conn = Redis.from_url(redis_url) # Kill jobs which don't finish within 5 minutes. JOB_TIMEOUT = 7 * 60 # Remove jobs from the queue if they haven't started within 5 minutes. QUEUE_TIMEOUT = 5 * 60 # Store the information that a job failed for 30 minutes.