introduce an ApplicationConfig module to manage the environment configs in one location

This commit is contained in:
Adrian Manteza
2022-03-17 20:33:48 +00:00
parent 2410e34c05
commit fede094eeb
4 changed files with 29 additions and 15 deletions

View File

@ -2,6 +2,7 @@ import os, json, random, io, logging
from pulp import LpProblem, LpVariable, LpMinimize, LpMaximize, LpAffineExpression, LpConstraint, LpStatus, lpSum
from lib.application_configs import ApplicationConfigs
from helpers import aws_helper, tar_helper, csv_helper, service_helper, solver_helper
from lib.errors.item_generation_error import ItemGenerationError
@ -201,14 +202,14 @@ class LoftService(Base):
if error:
logging.info('Streaming %s error response to s3 bucket - %s',
self.file_name, os.environ['S3_PROCESSED_BUCKET'])
self.file_name, ApplicationConfigs.s3_processed_bucket)
solution_file = service_helper.error_to_file(buffer, error)
else:
logging.info('Streaming %s to s3 bucket - %s', self.file_name,
os.environ['S3_PROCESSED_BUCKET'])
ApplicationConfigs.s3_processed_bucket)
solution_file = service_helper.solution_to_file(
buffer, self.solver_run.total_form_items, self.solution.forms)
# upload generated file to s3 and return result
return aws_helper.file_stream_upload(solution_file, self.file_name,
os.environ['S3_PROCESSED_BUCKET'])
ApplicationConfigs.s3_processed_bucket)