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 queue based observer #471

Merged
merged 16 commits into from
Jun 3, 2019

Conversation

JarnoRFB
Copy link
Collaborator

@JarnoRFB JarnoRFB commented May 2, 2019

No description provided.

@JarnoRFB JarnoRFB changed the title Add draft for queue based observer Add queue based observer May 2, 2019
@JarnoRFB JarnoRFB marked this pull request as ready for review May 7, 2019 12:27
@coveralls
Copy link

coveralls commented May 7, 2019

Coverage Status

Coverage increased (+0.2%) to 84.461% when pulling 98d51aa on JarnoRFB:feature-queue-based-observer into 7f7e1e0 on IDSIA:master.

@JarnoRFB JarnoRFB requested a review from Qwlouse May 7, 2019 12:43
@Qwlouse
Copy link
Collaborator

Qwlouse commented May 11, 2019

Hey! I don't understand what the purpose of this new MongoObserver variant is. Could you elaborate on your motivation?

@JarnoRFB
Copy link
Collaborator Author

JarnoRFB commented May 15, 2019

The purpose is to fix issues like #434. When the internet connection is disrupted, events can just accumulate in the queue. When the connection is restored, all events will be written to the database as originally intended. I tried to reflect this in the tests as well. Moreover, I expect some performance improvements, because IO should now happen in a separate thread.

@johny-c
Copy link

johny-c commented May 31, 2019

Hi, I guess this is relevant to all observers as they all could be remote servers depending on a network connection. I would be up for it if all observers read from a queue. As a suggestion, I think the go-to tool to implement such a pattern would be pyzmq.

@JarnoRFB
Copy link
Collaborator Author

JarnoRFB commented Jun 2, 2019

@johny-c yes, with the general QueueObserver class you can wrap any observer and make it use a queue. I just made it a bit more convenient for the MongoObserver and also had to make some changes, because it would silently gobble up some errors. I haven't used zmq yet, but it seems to be a bit overkill as the current implementations works quite well and the observers mostly do IO anyway.

@johny-c
Copy link

johny-c commented Jun 3, 2019

Nice, didn't see that. This seems like a major feature. Perhaps this should be indicated in a new sacred version (release)?

@JarnoRFB
Copy link
Collaborator Author

JarnoRFB commented Jun 3, 2019

yeah, documentation is missing I guess. I would like to try this out "in production" under the radar before releasing. Probably needs extra tests for each observer then as well to make sure they do not have similar problems as the MongoObserver. I will merge for now and see if unexpected problems pop up.

@JarnoRFB JarnoRFB merged commit 59f7e0d into IDSIA:master Jun 3, 2019
@wjaskowski
Copy link
Contributor

I was waiting for this feature for a long time! Couldn't that be a default? Currently, I set up my mongodb observer using the "-m" flag. To use that, I would need to hardcore mongodb options in the code. Or maybe there is a workaround?

@JarnoRFB
Copy link
Collaborator Author

JarnoRFB commented Jun 4, 2019

I think in the long run this should become a default. However, I first wanted to if the approach has any unexpected problems. I could add an optional switch for the queue based variant for now.

@wjaskowski
Copy link
Contributor

A quick feedback: works fine for me although I did not test with a broken connection. The only inconvenience is that when breaking the experiment from cmd with ctrl+c you need to press it 3 or 4 times to stop all threads I suppose.

rueberger added a commit to rueberger/sacred that referenced this pull request Jun 20, 2019
* 'master' of https://github.com/IDSIA/sacred:
  Release 0.7.5
  update dependencies to safer version of SQLAlchemy
  fixed numpy deprecation warning
  fix yaml deprecation warning
  Make config read only (IDSIA#472)
  Remove broken codacy badge (IDSIA#486)
  Add queue based observer (IDSIA#471)
  Run CI against python 36 and 37 (IDSIA#485)
  Make failed mongo observer dump configurable (IDSIA#462)
  Make stale time longer (IDSIA#484)
  Fix a bug where a unicode char in README.rst would fail install (IDSIA#481)
rueberger pushed a commit to rueberger/sacred that referenced this pull request Jun 21, 2019
…d into run_kwargs_fix

* 'run_kwargs_fix' of github.com-rueberger:rueberger/sacred:
  Release 0.7.5
  update dependencies to safer version of SQLAlchemy
  fixed numpy deprecation warning
  fix yaml deprecation warning
  Make config read only (IDSIA#472)
  Remove broken codacy badge (IDSIA#486)
  Add queue based observer (IDSIA#471)
  Run CI against python 36 and 37 (IDSIA#485)
  Make failed mongo observer dump configurable (IDSIA#462)
  Make stale time longer (IDSIA#484)
  Fix a bug where a unicode char in README.rst would fail install (IDSIA#481)
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

Successfully merging this pull request may close these issues.

None yet

5 participants