def load_task(cls, task_name) -> Task:
        """Loads tasks from the database and refreshes cache."""
        if task_name not in cls._store:
            # Only ExportTasks are registered dynamically
            logging.info(f"Registering ExportTask {task_name}")
            cls.register_task(ExportTask, task_name=task_name)

        if task_name not in cls._store:
            logging.error(f"Task {task_name} not found. Was it registered?")
            logging.error(f"Registered tasks: {cls._store.keys()}")
            raise ValueError(f"Task {task_name} not found. Was it registered?")

        task_class = cls._store[task_name].__class__
        task = task_class.find(name=task_name)
        assert task is not None
        cls._store[task_name] = task
        return task
Loads tasks from the database and refreshes cache.
core/taskmanager.py