Skip to content

Commit

Permalink
removed unused db_handler
Browse files Browse the repository at this point in the history
  • Loading branch information
popenc committed Nov 4, 2024
1 parent b2e745e commit 335a8e0
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
from cts_calcs.calculator_rdkit import RdkitCalc
from cts_calcs.calculator import Calculator
from cts_calcs.chemical_information import ChemInfo
from cts_calcs.mongodb_handler import MongoDBHandler
# from cts_calcs.mongodb_handler import MongoDBHandler
from cts_calcs.calculator_envipath import EnvipathCalc



db_handler = MongoDBHandler() # mongodb handler for opera pchem data
# db_handler = MongoDBHandler() # mongodb handler for opera pchem data

REDIS_HOSTNAME = os.environ.get('REDIS_HOSTNAME', 'localhost')
REDIS_PORT = os.environ.get('REDIS_PORT', 6379)
Expand All @@ -58,16 +58,14 @@
@app.task
def cts_task(request_post):

logging.warning("~~~ REQUEST POST: {}".format(request_post))

task_obj = CTSTasks()
# try:
task_obj.initiate_requests_parsing(request_post)
# except Exception as e:
# logging.warning("Error calling task: {}".format(e))
# if db_handler.is_connected:
# db_handler.mongodb_conn.close() # closes mongodb client connection
# task_obj.build_error_obj(request_post, 'cannot reach calculator', e) # generic error
try:
task_obj.initiate_requests_parsing(request_post)
except Exception as e:
logging.warning("Error calling task: {}".format(e))
# if db_handler.is_connected:
# db_handler.mongodb_conn.close() # closes mongodb client connection
task_obj.build_error_obj(request_post, 'cannot reach calculator', e) # generic error

@app.task
def removeUserJobsFromQueue(sessionid):
Expand Down

0 comments on commit 335a8e0

Please sign in to comment.