Skip to content

Commit

Permalink
don't define api_version variable for whole api.py file
Browse files Browse the repository at this point in the history
because reo/api.py now has Resources defined for versions 1 and 2
  • Loading branch information
hdunham committed Jul 26, 2022
1 parent 9d6fe51 commit a05a54b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions reo/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
from celery import group, chain
log = logging.getLogger(__name__)

api_version = "version 1.0.0"
saveToDb = True


Expand Down Expand Up @@ -99,6 +98,7 @@ def obj_get_list(self, bundle, **kwargs):
return self.get_object_list(bundle.request)

def obj_create(self, bundle, **kwargs):
api_version = "version 1.0.0"

# to use the Job API from within the REopt API (see futurecosts/api.py)
if isinstance(bundle, dict):
Expand Down Expand Up @@ -266,14 +266,15 @@ def obj_get_list(self, bundle, **kwargs):
return self.get_object_list(bundle.request)

def obj_create(self, bundle, **kwargs):
api_version = "version 2.0.0"

# to use the Job API from within the REopt API (see futurecosts/api.py)
if isinstance(bundle, dict):
bundle = self.build_bundle(obj=Job(), data=bundle)

run_uuid = str(uuid.uuid4())
data = dict()
data["outputs"] = {"Scenario": {'run_uuid': run_uuid, 'api_version': "2",
data["outputs"] = {"Scenario": {'run_uuid': run_uuid, 'api_version': api_version,
'Profile': {'pre_setup_scenario_seconds': 0, 'setup_scenario_seconds': 0,
'reopt_seconds': 0, 'reopt_bau_seconds': 0,
'parse_run_outputs_seconds': 0},
Expand Down Expand Up @@ -362,7 +363,7 @@ def obj_create(self, bundle, **kwargs):
content_type='application/json',
status=500)) # internal server error
setup = setup_scenario.s(run_uuid=run_uuid, data=data, api_version=2)
call_back = process_results.s(data=data, meta={'run_uuid': run_uuid, 'api_version': "2"})
call_back = process_results.s(data=data, meta={'run_uuid': run_uuid, 'api_version': api_version})
# (use .si for immutable signature, if no outputs were passed from reopt_jobs)
rjm = run_jump_model.s(data=data)
rjm_bau = run_jump_model.s(data=data, bau=True)
Expand Down

0 comments on commit a05a54b

Please sign in to comment.