in aepsych/server.py [0:0]
def get_strat_from_replay(self, uuid_of_replay=None, strat_id=-1):
if uuid_of_replay is None:
records = self.db.get_master_records()
if len(records) > 0:
uuid_of_replay = records[-1].experiment_id
else:
raise RuntimeError("Server has no experiment records!")
strat_buffer = self.db.get_strat_for(uuid_of_replay, strat_id)
if strat_buffer is not None:
return self._unpack_strat_buffer(strat_buffer)
else:
warnings.warn(
"No final strat found (likely due to old DB,"
+ " trying to replay tells to generate a final strat. Note"
+ " that this fallback will eventually be removed!",
DeprecationWarning,
)
# sometimes there's no final strat, e.g. if it's a very old database
# (we dump strats on crash) in this case, replay the setup and tells
self.replay(uuid_of_replay, skip_computations=True)
# then if the final strat is model-based, refit
strat = self._strats[strat_id]
if strat.has_model:
strat.modelbridge.fit(strat.x, strat.y)
return strat