Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

overriding the configuration incompatible with batchmode=True #192

Open
eelucio opened this issue Apr 8, 2024 · 0 comments
Open

overriding the configuration incompatible with batchmode=True #192

eelucio opened this issue Apr 8, 2024 · 0 comments
Assignees

Comments

@eelucio
Copy link
Contributor

eelucio commented Apr 8, 2024

If I do

import freva
freva.config("/patht/to/freva-instance.conf")

freva.run_plugin(**kwards, batchmode=True)

I get:

[18:57:55] ERROR    freva - ERROR - batchmode and overriding the config is not implemented - decrease  utils.py:101
                    log level via `freva.logger.setLevel` for more information    

However if I do:

import os
os.environ["EVALUATION_SYSTEM_CONFIG_FILE"] = FREVA_INSTANCES["xces"]["EVALUATION_SYSTEM_CONFIG_FILE"]
os.environ["EVALUATION_SYSTEM_CONFIG_DIR"] = FREVA_INSTANCES["xces"]["EVALUATION_SYSTEM_CONFIG_DIR"]
import freva

freva.run_plugin(**kwards, batchmode=True)

then it works fine.

This is related to:

        if batchmode:
            if freva.config.db_reloaded[0]:
                raise ValueError(
                    "batchmode and overriding the config is not implemented"
                )

that for what I understand is set as True here?:

    def __init__(self, config_file: Union[str, Path]) -> None:
        self._config_file = Path(config_file).expanduser().absolute()
        os.environ["EVALUATION_SYSTEM_CONFIG_FILE"] = str(self._config_file)
        cfg.reloadConfiguration(self._config_file)
        pm.reload_plugins()
        try:
            if django_settings.DATABASES:
                self.db_reloaded[0] = True
        except (ImproperlyConfigured, AttributeError):
            pass

I unfortunatelly do not know how to solve this issue

@eelucio eelucio assigned eelucio and antarcticrainforest and unassigned eelucio Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants