Repository: jina-ai/jina
File: jina/serve/runtimes/worker/request_handling.py (Python)

Code before:
                py_modules=self.args.py_modules,
                extra_search_paths=self.args.extra_search_paths,
            )
            self.logger.debug(f'{self._executor} is successfully loaded!')

        except BadConfigSource:
            self.logger.error(f'fail to load config from {self.args.uses}')
            raise
        except FileNotFoundError:
            self.logger.error(f'fail to load file dependency')
            raise
        except Exception:
            self.logger.critical(f'can not load the executor from {self.args.uses}')
            raise

    def _refresh_executor(self, changed_files):
        import importlib
        import inspect
        import copy
        import sys

        try:
            sys_mod_files_modules = {getattr(module, '__file__', ''): module for module in sys.modules.values()}

            for file in changed_files:
                importlib.reload(sys_mod_files_modules[file])
        except Exception as exc:
            self.logger.error(f' Exception when refreshing Executor when changes detected in {changed_files}')
            raise exc

        importlib.reload(inspect.getmodule(self._executor.__class__))
        requests = copy.copy(self._executor.requests)
        old_cls = self._executor.__class__
        new_cls = getattr(importlib.import_module(old_cls.__module__), old_cls.__name__)
        new_executor = new_cls.__new__(new_cls)
        new_executor.__dict__ = self._executor.__dict__
        for k, v in requests.items():
            requests[k] = getattr(new_executor.__class__, requests[k].__name__)
        self._executor = new_executor
        self._executor.requests.clear()
        requests = {k: v.__name__ for k, v in requests.items()}
        self._executor._add_requests(requests)

    @staticmethod
    def _parse_params(parameters: Dict, executor_name: str):
        parsed_params = parameters
        specific_parameters = parameters.get(executor_name, None)
        if specific_parameters:
            parsed_params.update(**specific_parameters)

        return parsed_params

Review comment (suggestion):
```suggestion
                if file in sys_mod_files_modules:
                    importlib.reload(sys_mod_files_modules[file])
```

Code after:
                py_modules=self.args.py_modules,
                extra_search_paths=self.args.extra_search_paths,
            )
            self.logger.debug(f'{self._executor} is successfully loaded!')

        except BadConfigSource:
            self.logger.error(f'fail to load config from {self.args.uses}')
            raise
        except FileNotFoundError:
            self.logger.error(f'fail to load file dependency')
            raise
        except Exception:
            self.logger.critical(f'can not load the executor from {self.args.uses}')
            raise

    def _refresh_executor(self, changed_files):
        import importlib
        import inspect
        import copy
        import sys

        try:
            sys_mod_files_modules = {getattr(module, '__file__', ''): module for module in sys.modules.values()}

            for file in changed_files:
                if file in sys_mod_files_modules:
                    importlib.reload(sys_mod_files_modules[file])
                else:
                    self.logger.debug(f'Changed file {file} was not previously imported.')
        except Exception as exc:
            self.logger.error(f' Exception when refreshing Executor when changes detected in {changed_files}')
            raise exc

        importlib.reload(inspect.getmodule(self._executor.__class__))
        requests = copy.copy(self._executor.requests)
        old_cls = self._executor.__class__
        new_cls = getattr(importlib.import_module(old_cls.__module__), old_cls.__name__)
        new_executor = new_cls.__new__(new_cls)
        new_executor.__dict__ = self._executor.__dict__
        for k, v in requests.items():
            requests[k] = getattr(new_executor.__class__, requests[k].__name__)
        self._executor = new_executor
        self._executor.requests.clear()
        requests = {k: v.__name__ for k, v in requests.items()}
        self._executor._add_requests(requests)

    @staticmethod
    def _parse_params(parameters: Dict, executor_name: str):
        parsed_params = parameters
        specific_parameters = parameters.get(executor_name, None)
        if specific_parameters: