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

FEAT: ExecutionPlan remember compilation results for elaborate plots #29

Open
wants to merge 94 commits into
base: master
Choose a base branch
from

Conversation

ankostis
Copy link

@ankostis ankostis commented Oct 6, 2019

Continuation (and bugfixing) of #26 (refact dag solver).
t
t

  • Merge with How to generate graph diagrams like those included in documentation? #13 (enhanced plots) to study bugs, the input & outputs used to build it, and to reason.
  • Network:
    • WIP/FIX: CONSISTENT ORDERED networkx.DiGraph for deterministic results (RFE: enhancements for the future of the project #22-2.4.3) - TCs were failing in < PY3.5..
      Unfortunately, it has not been fixed yet, just reduced the frequencyof failures, probably due to:
      • dicts,
      • use of subgraphs.
    • ENH: Mark allo data in NetworkOperation's need as optional.
      TODO: subgraph netops would not be fully functional until "optional outpus" are dealt with.
    • ENH: ExecutionPlan to know which operations have actually executed.
    • ENH: prunning drops also isolates (untested!).
    • fix: fix net.last_plan was never set (64e0028).
    • DROP: list_layers()/show layers() not needed, repr() is ok.
  • PLOT:
    • ENH: a pipeline plots last_plan if found. resolve issue with user args not passing through.
    • FIX: were failing if steps not a list/ is none.
    • ENH: +title, demarcate "broken links", cluster pruned nodes, draw executed operations drawn as filled.
    • REFACT: Move all API doc on plotting in a single module, splitted in 2 phases:
      • build dot
      • render dot
    • ENH(TCs): PYTEST-ize & strongly enhance plotting TCs.

I confirm that this contribution is made under the terms of the license found in the root directory of this repository's source tree and that I have the authority necessary to make this contribution on behalf of its copyright owner.

were writing in text-mode in PY3. and failing as encoding error.
receiving partial inputs, needed for other operations.
+ The x2 TCs added just before are now passing.
NOTE dict are not deterministic in <PY3.6.
So this commit would not improve determinism
in those pythons.

+ build: add `boltons` dependency for ndexedSet.
+ doc: mark all set usage if affect determinism.
+ e.g. see reproducibility problem in yahoo#14.
needed to refactor the new pruning algorithm.

- expected 2 TCs fail for yet-to-be-solved yahoo#24 & yahoo#25 bugs.
override intermediate data.

More changes only for newer pruning TCs:
+ refact(test): rename graph-->netop vars for results of compose(),
  to avoid of `graph.net.graph`.
+ Explain failure modes in v1.2.4 & this merged branch (yahoo#19 + yahoo#23).
not after compose().

+ All TCs pass ok.
+ NOTE this is not yet what is described in yahoo#21.
to pass +TC checking DeleteInst vary when inputs change.

- x4 TCs still failing, and need revamp of dag-solution.
+ Read the next doc-only commit to understand changes.
+ Renamed:
  + net.steps --> net.execution_plan.
  + (old)compile() --> _build_execution_plan()
  + _find_necessary_steps() --> (new)compile() + _solve_dag()
    compile() became the master function invoking _solve_dag &
    _build-execution_plan(), and do the caching.
+ refact(compute()): extract common tasks from sequential/parallel.
+ refact show_layers() to allow full-print, geting also string
  (not just printing), and using custom classes for representation.
+ Raise AssertionError when invalid class in plan.
  it's a logic error, not a language type-error.
Probaly unreported bug in v1.2.4 for '_neccessary_steps_cache`.
+ Pruning behaves correctly also when outputs given;
  this happens by breaking incoming provide-links
  to any given intermedediate inputs.
+ Unsatisfied detection now includes those without outputs
  due to broken links (above).
+ Remove some uneeded "glue" from unsatisfied-detection code,
  leftover from previous compile() refactoring.
+ Renamed satisfiable --> satisfied.
+ Improved unknown output requested raise-message.
+ x3 TCs PASS, x1 in yahoo#24 and the first x2 in yahoo#25.
- 1x TCs in yahoo#25 still FAIL, and need "Pinning" of given-inputs
  (the operation MUST and MUST NOT run in these cases).
numpy was used just for its assert_raise
…must run

- WIP: PARALLEL execution not adding PINS!
+ Insert "PinInstructions" in the execution-plan to avoid overwritting.
+ Add `_overwrite_collector` in `compose()` to collect re-calculated values.
+ FIX the last TC in yahoo#25.
- STILL buggy PIN on PARALLEL, 2 DISABLED TCs FAIL:
  - test_pruning_with_given_intermediate_and_asked_out()
  - test_unsatisfied_operations_same_out()
+ move check if value in asked outputs before cache-evicting it
  in build-execution-plan time - compute methods
  don't need outputs anymore.
+ test: speed up parallel/multihtread TCs
  by reducing delays & repetitions.
+ refact: network rightfully adopted stray functions
  for parallel processing - they all worke on the net.graph,
+ upd: networkx api by indexing on `dag.nodes` views.
+ enh: add log message when deleting in parallel
  (in par with sequential code).
+ refact: var-renames, if-then-else simplifications, pythonisms.
+ doc: A lot!
@ankostis ankostis force-pushed the refact-exeplan branch 2 times, most recently from 26f1b01 to 1566a7f Compare October 7, 2019 18:11
+ Partial fix deterministic results (yahoo#22-2.4.3i).
@ankostis
Copy link
Author

ankostis commented Oct 7, 2019

After FIX for deterministic results in < PY3.5 (fce0515), this can merge.

@ankostis ankostis changed the title WIP/FEAT: ExecutionPlan storing compilation results and elaborate plots FEAT: ExecutionPlan remember compilation results for elaborate plots Oct 7, 2019
@ankostis
Copy link
Author

ankostis commented Oct 7, 2019

And this is the legend:

t

(note that oval with circle are switched for operations)

Code to reproduce:

    digraph {
        rankdir=LR;
        subgraph cluster_legend {
        label="Graphkit Legend";
        
        operation   [shape=oval];
        pipeline    [shape=circle];
        insteps     [penwidth=3 label="in steps"];
        executed    [style=filled fillcolor=wheat];
        operation -> pipeline -> insteps -> executed [style=invis];

        data    [shape=rect];
        input   [shape=invhouse];
        output  [shape=house];
        inp_out [shape=hexagon label="inp+out"];
        evicted [shape=rect penwidth=3 color="#990000"];
        pinned  [shape=rect penwidth=3 color="purple"];
        evpin   [shape=rect penwidth=3 color=purple label="evict+pin"];
        sol     [shape=rect style=filled fillcolor=wheat label="in solution"];
        data -> input -> output -> inp_out -> evicted -> pinned -> evpin -> sol [style=invis];

        a1 [style=invis] b1 [color=invis label="dependency"];
        a1 -> b1;
        a2 [style=invis] b2 [color=invis label="optional"];
        a2 -> b2 [style=dashed];
        a3 [style=invis] b3 [color=invis penwidth=3 label="broken dependency"];
        a3 -> b3 [color=wheat penwidth=2];
        a4 [style=invis] b4 [color=invis penwidth=4 label="steps sequence"];
        a4 -> b4 [color="#009999" penwidth=4 style=dotted arrowhead=vee];
        b1 -> a2 [style=invis];
        b2 -> a3 [style=invis];
        b3 -> a4 [style=invis];
        }
    }

@ankostis ankostis force-pushed the refact-exeplan branch 7 times, most recently from 69124a8 to f2084e0 Compare October 8, 2019 10:55
+ test: some refacts on vars & for the uploaded images.
+ MARK SPURIOUS FAILS in < PY3.6 due to unordered dicts
  eg https://travis-ci.org/ankostis/graphkit/jobs/594813119
to support _repr_svg(), and it works without any flag.
+ graphop label renames,
+ DOT shortening.
+ FIX: `graph` is a DOT keyword, eg  pydot/pydot#111
  + Replaced `graph` --> `graphop`, inline with future refactoring.
+ Refactored example code.
+ New "Plotting" section under Quickstart.
+ Copy README instructions to main docs.
+ Abandoned `example_graph.svg`, replaced with `intro.svg`.
+ Recommend `.png` --> `.svg`, to save storage space.
- discovered BUG in MERGE saumple code (empty!).
... to adopt pytest args
+ mark wheel a universal.
ankostis referenced this pull request in syamajala/graphkit Oct 8, 2019
got values from v1.2.4
- ALL MERGE TCs FAIL!
many commits ago.

Never got it bc TC were not checking merges!
@ankostis
Copy link
Author

ankostis commented Oct 8, 2019

$ date
Tue 08 Oct 2019 07:01:59 PM EEST
$ cloc --by-file-by-lang  graphkit 
       6 text files.
       6 unique files.                              
       0 files ignored.

github.com/AlDanial/cloc v 1.82  T=0.01 s (537.8 files/s, 142257.3 lines/s)
------------------------------------------------------------------------------------
File                                  blank        comment           code
------------------------------------------------------------------------------------
graphkit/network.py                     145            305            253
graphkit/plot.py                         83            166            162
graphkit/base.py                         40             87             89
graphkit/functional.py                   48             77             82
graphkit/__init__.py                      3              3              5
graphkit/modifiers.py                     8             29              2
------------------------------------------------------------------------------------
SUM:                                    327            667            593
------------------------------------------------------------------------------------

-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
Python                           6            327            667            593
-------------------------------------------------------------------------------
SUM:                             6            327            667            593
-------------------------------------------------------------------------------

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.

2 participants