only for local dev
This commit is contained in:
parent
bd61fb7e81
commit
f893754f4c
@ -9,7 +9,7 @@ class Target(BaseModel):
|
||||
|
||||
@classmethod
|
||||
def max_drift(cls) -> int:
|
||||
return 15 # 15% elasticity, let it drift...
|
||||
return 0
|
||||
|
||||
@classmethod
|
||||
def max_drift_increment(cls) -> int:
|
||||
|
@ -162,8 +162,6 @@ class LoftService(Base):
|
||||
logging.info(f'attempt infeasible for drift of {current_drift}%')
|
||||
|
||||
if current_drift == Target.max_drift(): # this is the last attempt, so lets finalize the solution
|
||||
for v in problem.variables(): print(v.name, "=", v.varValue);
|
||||
|
||||
if ApplicationConfigs.local_dev_env: service_helper.print_problem_logs(problem);
|
||||
|
||||
logging.info(f'No feasible solution found for Form {form_number}!')
|
||||
|
@ -12,10 +12,12 @@ import logging
|
||||
|
||||
from pulp import LpProblem, LpVariable, LpInteger, LpMinimize, LpMaximize, LpAffineExpression, LpConstraint, LpStatus, lpSum
|
||||
from services.loft_service import LoftService
|
||||
from lib.application_configs import ApplicationConfigs
|
||||
|
||||
class SolverSandbox:
|
||||
def loft_service(body = {}):
|
||||
# body = {'Records': [{'eventVersion': '2.1', 'eventSource': 'aws:s3', 'awsRegion': 'us-east-1', 'eventTime': '2022-03-17T13:51:22.708Z', 'eventName': 'ObjectCreated:Put', 'userIdentity': {'principalId': 'AIDAJDPLRKLG7UEXAMPLE'}, 'requestParameters': {'sourceIPAddress': '127.0.0.1'}, 'responseElements': {'x-amz-request-id': '25ecd478', 'x-amz-id-2': 'eftixk72aD6Ap51TnqcoF8eFidJG9Z/2'}, 's3': {'s3SchemaVersion': '1.0', 'configurationId': 'testConfigRule', 'bucket': {'name': 'measure-local-solver-ingest', 'ownerIdentity': {'principalId': 'A3NL1KOZZKExample'}, 'arn': 'arn:aws:s3:::measure-local-solver-ingest'}, 'object': {'key': '40f23de0-8827-013a-a353-0242ac120010_solver_run.tar.gz', 'size': 491, 'eTag': '"2b423d91e80d931302192e781b6bd47c"', 'versionId': None, 'sequencer': '0055AED6DCD90281E5'}}}]}
|
||||
if ApplicationConfigs.local_dev_env:
|
||||
body = {'Records': [{'eventVersion': '2.1', 'eventSource': 'aws:s3', 'awsRegion': 'us-east-1', 'eventTime': '2022-03-17T13:51:22.708Z', 'eventName': 'ObjectCreated:Put', 'userIdentity': {'principalId': 'AIDAJDPLRKLG7UEXAMPLE'}, 'requestParameters': {'sourceIPAddress': '127.0.0.1'}, 'responseElements': {'x-amz-request-id': '25ecd478', 'x-amz-id-2': 'eftixk72aD6Ap51TnqcoF8eFidJG9Z/2'}, 's3': {'s3SchemaVersion': '1.0', 'configurationId': 'testConfigRule', 'bucket': {'name': 'measure-local-solver-ingest', 'ownerIdentity': {'principalId': 'A3NL1KOZZKExample'}, 'arn': 'arn:aws:s3:::measure-local-solver-ingest'}, 'object': {'key': '40f23de0-8827-013a-a353-0242ac120010_solver_run.tar.gz', 'size': 491, 'eTag': '"2b423d91e80d931302192e781b6bd47c"', 'versionId': None, 'sequencer': '0055AED6DCD90281E5'}}}]}
|
||||
|
||||
LoftService(body).process()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user