bionode / bionode-watermill

💧Bionode-Watermill: A (Not Yet Streaming) Workflow Engine
https://bionode.gitbooks.io/bionode-watermill/content/
MIT License
37 stars 11 forks source link

Add another test for fork within fork wrapped in join #73

Closed tiagofilipe12 closed 6 years ago

tiagofilipe12 commented 6 years ago

This PR fixes an issue with fork inside fork. Avoids the duplication of outermost tasks when fork is not nested in a join inside a fork. Previously this was not being properly handled because there was no way to check whether outermost tasks where the same as downstream tasks.

The rational is when fork is inside fork without join wrapping, outermost tasks will be the same as downstream tasks and thus should not be added to lineage twice. On the other hand when join is wrapping the inner fork, outermost tasks (after outer fork) are different from downstream tasks (after inner fork) and thus both should be added to lineage.

To achieve the comparison of these two arrays (outermostTasks and downstreamTasks) I have made two hashes for each by adding the individual hashes of each task within each one of these arrays, where these hashes are made with task.info.operationCreator. So, when all tasks inside both arrays have the same operationCreator it will return the same hash, otherwise they will be different.

Then was just a matter of checking if both hashes are equal or not.

codecov-io commented 6 years ago

Codecov Report

Merging #73 into dev will increase coverage by 0.43%. The diff coverage is 85.71%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev      #73      +/-   ##
==========================================
+ Coverage   81.83%   82.27%   +0.43%     
==========================================
  Files          37       37              
  Lines         881      897      +16     
  Branches      107      108       +1     
==========================================
+ Hits          721      738      +17     
+ Misses        160      159       -1
Impacted Files Coverage Δ
lib/orchestrators/join.js 92.55% <85.71%> (+0.24%) :arrow_up:
lib/reducers/collection.js 87.77% <0%> (+2.22%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 8fa4702...f1489b9. Read the comment docs.

tiagofilipe12 commented 6 years ago

multiple forks inside other forks were also fixed in this commit.

tiagofilipe12 commented 6 years ago

Tests for junction inside fork and fork inside fork (either wrapped in join or not) were added to check the shape of graph. This was performed by counting the length of the graphson array for vertices and for edges. I am aware that this is far from ideal but it is a quick way to check if something is broken in the near future. These tests must be re-worked after refactoring the pipeline object to something that can be run before execution.

thejmazz commented 6 years ago

@tiagofilipe12 delete branch?