def upgrade(self):
        if not os.path.exists(self.folder_path):
            print("Error: instance folder does not exist")
            sys.exit(1)

        try:
            actual_path = iepy.setup(self.folder_path, _safe_mode=True)
        except __HOLE__ as err:
            print(err)
            sys.exit(1)
        finally:
            self.folder_path = actual_path
            self.abs_folder_path = os.path.abspath(self.folder_path)

        from django.conf import settings
        self.old_version = settings.IEPY_VERSION
        if settings.IEPY_VERSION == iepy.__version__:
            print("Iepy instance '{}' is already up to date.".format(self.folder_path))
            return
        print("Upgrading iepy instance '{}' from {} to {}".format(
            self.folder_path, self.old_version, iepy.__version__))
        self.creating = False
        self.old_version_path = self.download_old_iepy_version()
        self._run_steps()
dataset/ETHPy150Open machinalis/iepy/iepy/instantiation/instance_admin.py/InstanceManager.upgrade