Skip to content

Commit

Permalink
replacing prints for logs
Browse files Browse the repository at this point in the history
  • Loading branch information
costero-e committed Oct 14, 2024
1 parent b159ebf commit f461c85
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 28 deletions.
25 changes: 2 additions & 23 deletions beacon/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,34 +389,13 @@ async def create_api():# pragma: no cover
app.add_routes([web.get('/api/runs/{id}', Resultset)])
app.add_routes([web.get('/api/runs/{id}/analyses', Resultset)])
app.add_routes([web.get('/api/runs/{id}/g_variants', Resultset)])
'''
cors_dict={}
for origin in cors_urls:
cors_dict[origin]=aiohttp_cors.ResourceOptions(
allow_credentials=True,
expose_headers="*",
allow_methods=("POST", "PATCH", "GET", "OPTIONS"),
allow_headers=DEFAULT_ALLOW_HEADERS
)
cors = aiohttp_cors.setup(app, defaults={
"http://localhost:3000": aiohttp_cors.ResourceOptions(
allow_credentials=True,
expose_headers="*",
allow_methods=("POST", "PATCH", "GET", "OPTIONS"),
allow_headers=DEFAULT_ALLOW_HEADERS
)
})
for route in list(app.router.routes()):
cors.add(route, cors_dict)
cors.add(web.options('/api/g_variants', Resultset), cors_dict)
'''

ssl_context = None
if (os.path.isfile(conf.beacon_server_key)) and (os.path.isfile(conf.beacon_server_crt)):
ssl_context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
ssl_context.load_cert_chain(certfile=conf.beacon_server_crt, keyfile=conf.beacon_server_key)

print("Starting app")
LOG.debug("Starting app")
runner = web.AppRunner(app)
await runner.setup()
site = web.TCPSite(runner, '0.0.0.0', 5050, ssl_context=ssl_context)
Expand Down
4 changes: 0 additions & 4 deletions beacon/connections/mongo/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,6 @@ def cross_query(self, query: dict, scope: str, collection: str, request_paramete
def apply_filters(self, query: dict, filters: List[dict], collection: str, query_parameters: dict) -> dict:
request_parameters = query_parameters
total_query={}
LOG.debug(filters)
LOG.debug(query_parameters)
if len(filters) >= 1:
total_query["$and"] = []
if query != {} and request_parameters == {}:
Expand Down Expand Up @@ -387,8 +385,6 @@ def apply_filters(self, query: dict, filters: List[dict], collection: str, query
if total_query["$and"] == [{'$or': []}] or total_query['$and'] == []:
total_query = {}
if total_query == {} and query != {}:
LOG.debug('ene')
LOG.debug(query)
total_query=query
return total_query

Expand Down
3 changes: 2 additions & 1 deletion beacon/connections/mongo/ping.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from pymongo.errors import ConnectionFailure
import conf
import os
from beacon.logs.logs import LOG


uri = "mongodb://{}:{}@{}:{}/{}?authSource={}".format(
Expand All @@ -22,4 +23,4 @@
try:
client.admin.command('ping')
except ConnectionFailure as err:
print(f"Database error encountered: {err}")
LOG.debug(f"Database error encountered: {err}")

0 comments on commit f461c85

Please sign in to comment.