def _run_operation()

in backend/bms_app/services/operations/restore.py [0:0]


    def _run_operation(self, source_db, operation,
                       operation_details, db_mappings_objects):
        """Run pre-restore operation.

        Depending on RestoreConfig.validations possible options to run are:
        - rman validations (requires starting control node)
        - disk space validation (does not require control node)
        - both: rman and disk space validation
        """
        rcv = RestoreConfigValidationsService(source_db)

        if rcv.needs_rman_validation() \
                and not rcv.needs_disk_space_validation():
            # start control node only
            # operation will be closed as usually by msg from pubsub
            self._start_pre_deployment(
                source_db,
                operation,
                db_mappings_objects,
            )
        elif not rcv.needs_rman_validation() \
                and rcv.needs_disk_space_validation():
            # run only disk space validation
            # and finish/close operation depending on the validation result
            now = datetime.now()
            opd_handler = PreRestoreOperationDetailStatusHandler(
                operation_details[0],
                now,
            )

            is_valid = self._run_disk_space_validation(
                source_db,
                operation_details[0]
            )

            if is_valid:
                opd_handler.set_complete()
            else:
                opd_handler.set_fail()

            self.OPERATION_STATUS_HANDLER(
                operation,
                completed_at=now,
            ).finish()

        elif rcv.needs_disk_space_validation() \
                and rcv.needs_disk_space_validation():
            # start contorl node and run disk space validation
            # operation will be closed as usually by msg from pubsub
            self._run_disk_space_validation(
                source_db,
                operation_details[0]
            )
            self._start_pre_deployment(
                source_db,
                operation,
                db_mappings_objects,
            )