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

log.txt not updated after changing parameter through change in config=Wflow.config(wflwow_sbm.toml) #234

Open
ahweerts opened this issue Nov 27, 2022 · 7 comments
Assignees
Labels
bug Something isn't working v1.0 Activities related to v1.0
Milestone

Comments

@ahweerts
Copy link

    "-e"
   "using Wflow;
    config = Wflow.Config(\"model/{{inputs.parameters.uuid}}/wflow_sbm.toml\");
    config.input.lateral.subsurface.ksathorfrac.value=({{workflow.parameters.ksathorfrac}});
    Wflow.run(config);

log.txt keeps default value and not the the value assigned ({{workflow.parameters.ksathorfrac}});

this is de default in the toml

[input.lateral.subsurface]
ksathorfrac.value = 100

@visr
Copy link
Member

visr commented Nov 27, 2022

That is strange, this should work. I tried, but cannot reproduce:

using Wflow

# modified TOML to have
# [input.lateral.subsurface]
# ksathorfrac.value = 1.0
config = Wflow.Config("test/sbm_simple.toml")

config.input.lateral.subsurface.ksathorfrac.value  # 1.0
config.input.lateral.subsurface.ksathorfrac.value = 2.0
config.input.lateral.subsurface.ksathorfrac.value  # 2.0

Wflow.run(config)  # logs: Info: Set `lateral.subsurface.ksathorfrac` using default value `2.0`.

Perhaps you could add println(config.input.lateral.subsurface.ksathorfrac.value); before and after your change to make sure it is working as intended?

@ahweerts
Copy link
Author

thx, i see that the log.txt file is not created at all, hence they are all the same. I also see the value is properly being picked up. However, I don't understand why the log.txt file is not being created.

@visr
Copy link
Member

visr commented Nov 27, 2022

Oh yes if you use Wflow.run with a config object rather than a path to a TOML file it doesn't create the logging file.

This is mentioned in the docstring

Wflow.jl/src/Wflow.jl

Lines 137 to 138 in d1dcbfe

if you want to for example modify a `Config` before initializing the `Model`. Logging to a
file is only part of the `run(tomlpath::AbstractString)` method. To avoid logging to the

But would be good to mention in the logging docs as well.

Probably we can also fix that, right now it's done like that do avoid creating the file twice since one method calls the other.

@verseve
Copy link
Contributor

verseve commented Dec 14, 2022

I have added a small sentence to the logging docs about this: a41dc53.

We could indeed fix this. On the other hand, since this is in most cases run from a custom Julia file, I guess it is probably easier to just implement the logging at that level.

@JoostBuitink JoostBuitink added the bug Something isn't working label Apr 17, 2023
@github-project-automation github-project-automation bot moved this to 🔲 Todo in Wflow Apr 17, 2023
@pauwiersma
Copy link

I'm running wflow through the pywflow wrapper, which uses Wflow.run with a config object, so I'm having the same problem. It would be very helpful to be able to set the silent=True setting in the toml file. Has there been any development on this bug, and if not, is there perhaps a quick patch that I can apply locally where I hardcode the option to not print everything to the terminal? I could try it myself but I doubt that I'll find a solution quickly

@verseve
Copy link
Contributor

verseve commented Sep 26, 2023

It would be very helpful to be able to set the silent=True setting in the toml file.

It is possible to set silent=true in the TOML file. Would that help in your case?

If logging to a file is in your case important, you could follow the logic in the Wflow.run function with a TOML path for the logging part, and use that in a custom run function.

@pauwiersma
Copy link

pauwiersma commented Sep 26, 2023

I have added silent=True to the TOML file, along with loglevel and pathlog but none of them are read.
I found out that bmi.initialize() actually doesn't call any of the run() functions in Wflow.jl but goes directly to initialize_sbm_model() in sbm_model.jl. Copy-pasting the logging lines from run(tomlpath::AbstractString) to this function does the silencing job for now. Somehow if I set silent=False and loglevel=warn it still prints all the info statements and nothing is written to the logfile but I'm not really concerned about this for the moment.

@JoostBuitink JoostBuitink added the v1.0 Activities related to v1.0 label Feb 8, 2024
@alimeshgi alimeshgi added this to the 2024 - Q2 milestone Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working v1.0 Activities related to v1.0
Projects
No open projects
Status: 🔲 Todo
Development

No branches or pull requests

6 participants