Opened 3 years ago
Closed 3 years ago
#20376 closed enhancement (fixed)
LoggingBackend - delegating MIP backend class that logs input/output to backend methods
Reported by: | mkoeppe | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-7.2 |
Component: | numerical | Keywords: | lp |
Cc: | dimpase, vdelecroix, vbraun, nthiery | Merged in: | |
Authors: | Matthias Koeppe | Reviewers: | Dima Pasechnik |
Report Upstream: | N/A | Work issues: | |
Branch: | f17cd9b (Commits) | Commit: | f17cd9b799125912f098e541e950f1374674e6ca |
Dependencies: | #20406, #20323 | Stopgaps: |
Description (last modified by )
This is a debugging tool. It logs calls to the methods of MIP backends.
There are three output formats:
- on-screen comments
- doctests, suitable for cut and paste
_test_*
methods for the backends (#20323).
I have already used this code to translate the testcase using the MixedIntegerLinearProgram
reported in #18572 to a testcase in the style of the _test_*
methods for the backends. The result has been committed on #20424 .
Change History (26)
comment:1 Changed 3 years ago by
- Branch set to u/mkoeppe/loggingbackend___delegating_mip_backend_class_that_logs_input_output_to_backend_methods
comment:2 Changed 3 years ago by
- Commit set to e7ef1eab2afffb239b253b354cdebff8965af13c
comment:3 Changed 3 years ago by
- Cc dimpase vdelecroix vbraun nthiery added
- Dependencies set to #20406, #20323
- Description modified (diff)
comment:4 Changed 3 years ago by
- Commit changed from e7ef1eab2afffb239b253b354cdebff8965af13c to 4983cc757f72093976d2dfc83beb37be71add00e
Branch pushed to git repo; I updated commit sha1. This was a forced push. Last 10 new commits:
d1d84c6 | get_solver: Add doctest
|
cc2d999 | Mention solver=callable in docstrings and error messages
|
37e87a5 | Replace delsarte test by one that does not expose a bug in GLPK exact
|
2b0626f | First attempt at LoggingBackend
|
4e5c439 | This is as far as we get with __getattr__
|
5282a79 | LoggingBackend: Inherit from GenericBackend, override methods
|
deedc16 | LoggingBackend: add test method writer
|
cc845f7 | Use assertAlmostEqual for float; don't log zero and base_ring
|
2f4b58c | Add doctest
|
4983cc7 | Fix docstring
|
comment:5 Changed 3 years ago by
- Description modified (diff)
- Status changed from new to needs_review
rebased on top of current #20406.
comment:6 Changed 3 years ago by
comment:7 Changed 3 years ago by
it would be great to have a concrete explained example in the docs like "suppose we want to test that foo does baz. Then we..."
comment:8 Changed 3 years ago by
- Commit changed from 4983cc757f72093976d2dfc83beb37be71add00e to 12261790b750b1757e6d958c6fa3b6d3e0f5b548
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
632e81d | First attempt at LoggingBackend
|
3c96d9f | This is as far as we get with __getattr__
|
123c066 | LoggingBackend: Inherit from GenericBackend, override methods
|
8c2612d | LoggingBackend: add test method writer
|
9c69834 | Use assertAlmostEqual for float; don't log zero and base_ring
|
422226c | Add doctest
|
b66cd6d | Fix docstring
|
1226179 | Add more documentation and examples
|
comment:9 Changed 3 years ago by
I've added a better example.
comment:10 Changed 3 years ago by
there is no trace of this backend in the docs. You probably want to add it to some index in an rst file...
comment:11 Changed 3 years ago by
- Commit changed from 12261790b750b1757e6d958c6fa3b6d3e0f5b548 to a2217679f53c50dc44bab546de982b7b8d841ad9
comment:12 Changed 3 years ago by
Thanks for the reminder; I've added it to the documentation index.
comment:13 Changed 3 years ago by
in
call `compute_something` in the doctest
compute_something
is being typeset in the doc as a maths expression. I guess it needs :func:
prefix.
As well, after EXAMPLES there is a long list
add_col(*args, **kwdargs) add_linear_constraint(*args, **kwdargs) ... write_mps(*args, **kwdargs)
Is it how it is meant to look?
comment:14 Changed 3 years ago by
- Commit changed from a2217679f53c50dc44bab546de982b7b8d841ad9 to b1db4dced251560e239b2ad2d21d4423b4e819fe
Branch pushed to git repo; I updated commit sha1. New commits:
b1db4dc | Improvement for generated documentation
|
comment:15 follow-up: ↓ 17 Changed 3 years ago by
I've fixed the markup of that function, actually using double-backquotes.
The long list is a list of all instrumented methods that comes from the backend. I don't know if it should be suppressed, and if yes, how. I also don't know how to remove the strange stuff at the very bottom of that page.
comment:16 Changed 3 years ago by
patchbots complain
Missing doctests in numerical/backends/logging_backend.py: 1 / 5 = 20%
comment:17 in reply to: ↑ 15 Changed 3 years ago by
Replying to mkoeppe:
The long list is a list of all instrumented methods that comes from the backend. I don't know if it should be suppressed, and if yes, how.
You can place .. auto***
directives in the docstrings of classes; although I don't exactly know how to achieve what we want. See the doc here:
http://www.sphinx-doc.org/en/stable/ext/autodoc.html#confval-autoclass_content
and there are examples in src/sage/ doing something like this: grep -R "\.\. auto" *
will show a lot...
I also don't know how to remove the strange stuff at the very bottom of that page.
no idea either...
comment:18 Changed 3 years ago by
- Commit changed from b1db4dced251560e239b2ad2d21d4423b4e819fe to 879c033b7bc5b245e19e7fc041ce487968fe6bac
Branch pushed to git repo; I updated commit sha1. This was a forced push. Last 10 new commits:
d39dfde | LoggingBackend: Inherit from GenericBackend, override methods
|
028c64f | LoggingBackend: add test method writer
|
9df27fd | Use assertAlmostEqual for float; don't log zero and base_ring
|
9408e50 | Add doctest
|
dd95cb9 | Fix docstring
|
0d2e9d9 | Add more documentation and examples
|
07bd122 | Add logging_backend to documentation index
|
b69f62d | Use print_function and output get_solver calls too
|
9fbba6d | Improvement for generated documentation
|
879c033 | Add documentation to wrappers and clean up namespace. Fixes generated documentation
|
comment:19 Changed 3 years ago by
Found a solution for the documentation.
comment:20 Changed 3 years ago by
- Commit changed from 879c033b7bc5b245e19e7fc041ce487968fe6bac to a5498426bfadc8ac824861a40a0a50e9bb2f8c11
Branch pushed to git repo; I updated commit sha1. New commits:
a549842 | Add doctests
|
comment:21 Changed 3 years ago by
- Commit changed from a5498426bfadc8ac824861a40a0a50e9bb2f8c11 to 05c6c38bc47b186437b021581d63f8696c19156c
Branch pushed to git repo; I updated commit sha1. New commits:
05c6c38 | Faking the base_ring
|
comment:22 Changed 3 years ago by
- Commit changed from 05c6c38bc47b186437b021581d63f8696c19156c to f17cd9b799125912f098e541e950f1374674e6ca
Branch pushed to git repo; I updated commit sha1. New commits:
f17cd9b | LoggingBackendFactory: Make the interface more user-friendly
|
comment:23 Changed 3 years ago by
- Reviewers set to Dima Pasechnik
- Status changed from needs_review to positive_review
looks good to me. By the way, you use deprecated db()
stuff. Are you going to undo #2536 ?
comment:24 Changed 3 years ago by
I'm not using it.
The LoggingBackend
simply instruments every method that the backend has, including stuff that I never heard of or that was deprecated a decade ago.
comment:25 Changed 3 years ago by
Ah, OK, never mind then (I had a quick look at generated docs, and saw that db()
there...)
comment:26 Changed 3 years ago by
- Branch changed from u/mkoeppe/loggingbackend___delegating_mip_backend_class_that_logs_input_output_to_backend_methods to f17cd9b799125912f098e541e950f1374674e6ca
- Resolution set to fixed
- Status changed from positive_review to closed
Branch pushed to git repo; I updated commit sha1. New commits:
LoggingBackend: add test method writer
Use assertAlmostEqual for float; don't log zero and base_ring
Add doctest