Skip to content

Commit

Permalink
feat[fdb]: create and destroy object for each request
Browse files Browse the repository at this point in the history
  • Loading branch information
peshence committed Jan 9, 2025
1 parent b71daf4 commit f9a8cf1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions polytope_server/common/datasource/fdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from datetime import datetime, timedelta
from pathlib import Path

import pyfdb
import yaml
from dateutil.relativedelta import relativedelta

Expand All @@ -49,9 +50,6 @@ def __init__(self, config):
os.environ["FDB_CONFIG"] = json.dumps(self.fdb_config)
os.environ["FDB5_HOME"] = self.config.get("fdb_home", "/opt/fdb")
os.environ["FDB_HOME"] = self.config.get("fdb_home", "/opt/fdb")
import pyfdb

self.fdb = pyfdb.FDB()

if "spaces" in self.fdb_config:
for space in self.fdb_config["spaces"]:
Expand Down Expand Up @@ -114,16 +112,18 @@ def archive(self, request):
# could add a check that the request is a singular object (does not contain)

# r = yaml.safe_load(request.user_request)
self.fdb.archive(self.input_data)
self.fdb.flush()
fdb = pyfdb.FDB()
fdb.archive(self.input_data)
fdb.flush()
self.output = None
return True

def retrieve(self, request):

r = yaml.safe_load(request.user_request)
logging.info(r)
self.output = self.fdb.retrieve(r)
fdb = pyfdb.FDB()
self.output = fdb.retrieve(r)
return True

def repr(self):
Expand Down

0 comments on commit f9a8cf1

Please sign in to comment.