in backend/bms_app/services/operations/restore.py [0:0]
def run(self, db_id):
source_db = db.session.query(SourceDB).with_for_update().get(db_id)
self._validate_source_db(source_db)
self._set_source_db_status(source_db)
db_mappings_objects = get_restore_db_mappings_objects(db_id=db_id)
self._validate_db_mappings_objects(db_mappings_objects)
operation = self._create_operation_model(wave_id=None)
self._log(operation, db_mappings_objects)
operation_details = self._create_operation_details_models(
operation,
db_mappings_objects
)
try:
self._run_operation(
source_db,
operation,
operation_details,
db_mappings_objects
)
except Exception:
logger.exception(
'Error starting %s %s',
operation.id,
operation.operation_type.value
)
self._handle_pre_deployment_failure(operation)
db.session.commit()