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

Add unique log files for each mongo worker #2016

Merged
merged 7 commits into from
Apr 5, 2024

Conversation

Cmurilochem
Copy link
Collaborator

@Cmurilochem Cmurilochem commented Mar 21, 2024

Aim

Allow mongo workers to write output data to separate files.

Idea

Redirect the output of each subprocess.Popen to unique log files (stdout) for each mongo worker. These files are named mongo-worker_n_output_path.log, where n=0, 1, 2, ..., n is the unique id of the worker and output_path corresponds to the runcard name or OUTPUT if n3fit -o OUTPUT was used.

Notes/Drawbacks

The mongo-worker_n_output_path.log files will only contain data output by any function/method called by fmin, i.e., by ModelTrainer.hyperparametrizable which consists of details of the hyperparameters being evaluated and info about epochs. Other infos and warnings are still printed to standard output (screen), including trial numbers which might not be ideal.

Either way, it appears that with this simple change we can prevent the overwhelming/chaotic information that was previously displayed on the screen.

Tasks

  • Add stdout redirection files to start_mongo_workers Popen.
  • Add name of the runcard/output to the mongo_worker log file
  • Test in snellius

Copy link
Member

@Radonirinaunimi Radonirinaunimi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Cmurilochem for this. This would be useful indeed to know what happened during a trial.

n3fit/src/n3fit/hyper_optimization/mongofiletrials.py Outdated Show resolved Hide resolved
n3fit/src/n3fit/hyper_optimization/mongofiletrials.py Outdated Show resolved Hide resolved
n3fit/src/n3fit/hyper_optimization/mongofiletrials.py Outdated Show resolved Hide resolved
@Cmurilochem Cmurilochem force-pushed the dev_mongoworkers_output_files branch from 9b2fb60 to 11f9155 Compare March 29, 2024 14:57
@APJansen APJansen mentioned this pull request Apr 2, 2024
@Cmurilochem Cmurilochem force-pushed the dev_mongoworkers_output_files branch from 11f9155 to 4bdcca4 Compare April 5, 2024 06:41
Copy link
Member

@Radonirinaunimi Radonirinaunimi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks again.

@Cmurilochem
Copy link
Collaborator Author

LGTM! Thanks again.

Thanks @Radonirinaunimi. Not sure if @RoyStegeman wants to have a look at it, but if not, could you merge it ?
It seems that I do not have permissions to so any more.

Copy link
Member

@RoyStegeman RoyStegeman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Cmurilochem! This looks good to me as well, feel free to merge after making these changes. If you agree with them of course

n3fit/src/n3fit/hyper_optimization/mongofiletrials.py Outdated Show resolved Hide resolved
n3fit/src/n3fit/hyper_optimization/mongofiletrials.py Outdated Show resolved Hide resolved
Cmurilochem and others added 3 commits April 5, 2024 13:19
@Cmurilochem
Copy link
Collaborator Author

Thanks @Cmurilochem! This looks good to me as well, feel free to merge after making these changes. If you agree with them of course

Thanks @RoyStegeman. Suggestions accepted. It seems that I am not authorized to merge this PR. Please, could you do that ?

@RoyStegeman RoyStegeman merged commit f60ce60 into master Apr 5, 2024
6 checks passed
@RoyStegeman RoyStegeman deleted the dev_mongoworkers_output_files branch April 5, 2024 12:18
@RoyStegeman
Copy link
Member

Ah, I hadn't realised you were not registered as a member of this organisation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants