QuantEcon.py icon indicating copy to clipboard operation
QuantEcon.py copied to clipboard

Watcher for long computations

Open albop opened this issue 10 years ago • 8 comments

I have been using this code on my server to track long computations: https://gist.github.com/albop/8c94e8694369474f7c85 . It is used to track long computations and send an email when they are finished. It uses a context-manager in the following way:

with watcher('computation name', email='[email protected]'):
    run_long_computation()

When the computation is finished it prints on screen the number of days or seconds elapsed and sends a notification by email. A few easy improvements could be made to it:

  • allow to use desktop notification instead of email
  • add an IPython cell/line magic to do the same

What do you think ? If polished a little bit (no docstring), it could be a nice addition.

albop avatar Feb 13 '15 18:02 albop

This is neat. +1 for adding it to the library once the docstring is included, perhaps in timing.py. Alternatively timing.py can be renamed utils.py as per @spencerlyon2 's suggestion.

jstac avatar Feb 14 '15 22:02 jstac

Good idea ... +1 for adding it to the library. I have just recently been thinking of implementing something similar.

On Sun, Feb 15, 2015 at 9:22 AM, John Stachurski [email protected] wrote:

This is neat. +1 for adding it to the library once the docstring is included, perhaps in timing.py. Alternatively timing.py can be renamed utils.py as per @spencerlyon2 https://github.com/spencerlyon2 's suggestion.

— Reply to this email directly or view it on GitHub https://github.com/QuantEcon/QuantEcon.py/issues/125#issuecomment-74394541 .

mmcky avatar Feb 15 '15 06:02 mmcky

@albop I will write and docstring and include this in the new utils subpackage once the RandomMarkov PR has been merged. There is a reorganisation of utilities in that branch and I don't want to cause any merge conflicts.

mmcky avatar Aug 05 '15 13:08 mmcky

Basic tic, tac, tok functions are now in utils sub-package. Leaving open for suggested improvements.

mmcky avatar Aug 28 '15 16:08 mmcky

@mmcky: where does this one stands ? I just realized that I may have forgotten to make the gist public.

albop avatar Jan 22 '16 14:01 albop

Hey @albop - thanks for the reminder. Do you want to submit a PR or should I just add this to the utils subpackage? We will probably want to have an email parameter for the test function - otherwise you may get a lot of test responses :).

mmcky avatar Jan 22 '16 14:01 mmcky

Good catch about the email ! That was careless of me... I honestly don't know if it's ready to merge. This was more a proof of concept and should probably be tested on a few platforms before merging. I don't know whether it works on windows for instance. Desktop notification would be good too, although not mandatory.

albop avatar Jan 22 '16 15:01 albop

Ok - Cool. I will have a look into this feature next week. I really would like this functionality.

mmcky avatar Jan 22 '16 15:01 mmcky