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

Is there any way to hide non-critical logs to stdout? #85

Open
u3Izx9ql7vW4 opened this issue May 13, 2024 · 8 comments
Open

Is there any way to hide non-critical logs to stdout? #85

u3Izx9ql7vW4 opened this issue May 13, 2024 · 8 comments

Comments

@u3Izx9ql7vW4
Copy link

Hi,

The dehb package is producing a large amount of logs into stdout, and they're not contained within the dehb namespace, but rather polluting the global namespace, which makes it difficult to read logs coming from any host program.

Is there anyway to turn off this behavior and only have it log errors like other programs?

Thanks,

@Bronzila
Copy link
Collaborator

Bronzila commented May 14, 2024

Hey, I'm assuming you are using DEHB.run. If so, have you tried using the verbosity flag, i.e. DEHB.run(..., verbose=False). Then you should only be left with outputs regarding state saving/logging.

@Bronzila
Copy link
Collaborator

Anyways, thanks for you issue! Since the state saving logs could also fill stdout with a lot of logs, we should maybe think about adding a verbosity level for the whole DEHB class and not just the run function.

@u3Izx9ql7vW4
Copy link
Author

u3Izx9ql7vW4 commented May 29, 2024

Hey, I'm assuming you are using DEHB.run. If so, have you tried using the verbosity flag, i.e. DEHB.run(..., verbose=False). Then you should only be left with outputs regarding state saving/logging.

Yes that's correct, verbose is set to False, but I'm getting lots of these messages to stdout.

2024-05-29 12:04:56.361 | INFO     | dehb.optimizers.dehb:reset:119 - 

RESET at 05/29/24 12:04:56 PDT


2024-05-29 12:04:56.417 | INFO     | dehb.optimizers.dehb:reset:119 - 

RESET at 05/29/24 12:04:56 PDT


2024-05-29 12:04:56.468 | INFO     | dehb.optimizers.dehb:reset:119 - 

RESET at 05/29/24 12:04:56 PDT


2024-05-29 12:04:56.519 | INFO     | dehb.optimizers.dehb:reset:119 - 

RESET at 05/29/24 12:04:56 PDT

Somewhat related is that this package appears to be accumulating lots of logs that does not get cleaned up after a run is complete. For me, dehb has accumulated almost to 20GB of log data since I've installed 4 weeks ago.

Capture d’écran 2024-05-29 à 12 18 30

^ After clearing it 2 weeks ago.

@u3Izx9ql7vW4
Copy link
Author

lots of these messages to stdout.

They appear to be coming from dehb.py:119, removing that line solved the issue for me

    def reset(self):
        self.inc_score = np.inf
        self.inc_config = None
        self.population = None
        self.fitness = None
        self.traj = []
        self.runtime = []
        self.history = []
        self.logger.info("\n\nRESET at {}\n\n".format(time.strftime("%x %X %Z")))

@Bronzila
Copy link
Collaborator

Nice to hear, that this could solve your issue. In the upcoming release the logging structure will anyways be adjusted since currently for every instantiation of DEHB the logs will be written to some specific file. In the upcoming release it will just be written to dehb.log and thus will be overwritten by new instatiations of DEHB (assuming that you do not adjust the output path).

@u3Izx9ql7vW4
Copy link
Author

u3Izx9ql7vW4 commented Jun 1, 2024

Good to know, thanks for looking into the issue and looking forward to the fix.

In the upcoming release it will just be written to dehb.log and thus will be overwritten by new instatiations of DEHB

Will this affect the ability to run multiple DEHB instances running simultaneously? In my use case, the host program optimizes many different models in parallel.

@Neeratyoy
Copy link
Collaborator

Will this affect the ability to run multiple DEHB instances running simultaneously?

This should not, assuming each DEHB instance is an independent optimization run since then the output_path should vary.
@Bronzila could you please correct me or add anything if required.

@Bronzila
Copy link
Collaborator

Bronzila commented Jun 2, 2024

Sorry, I must have overlooked your comment @u3Izx9ql7vW4
As @Neeratyoy pointed out, as long as each DEHB instance has a unique output_path no results will be overwritten.

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

3 participants