Skip to content

Commit

Permalink
Downgrade ERROR to WARNING for orphan branches #183
Browse files Browse the repository at this point in the history
  • Loading branch information
zouyuxin committed Apr 24, 2019
1 parent cbb7999 commit 6baebf1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ Goal for 0.4.0

### 0.3.x

0.3.9

- Issue #183

0.3.8

- Issue #171 is partially improved.
Expand Down
9 changes: 5 additions & 4 deletions src/query_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,13 +242,14 @@ def get_sequence(primary, reference):
if primary == previous_primary:
break
# a sequence can lose dependency half-way
# in which case an error message will be given
# in which case an warning message will be given
orphans = []
for idx, item in enumerate(primary):
if idx == len(primary) - 1:
break
if self.depends is not None and primary[idx+1] not in self.depends[item]:
raise ValueError(f'Requested module ``{primary[idx+1]}`` is an orphan branch. Please consider using separate queries for information from this module.')
return primary
logger.warning(f'Requested module ``{primary[idx+1]}`` is an orphan branch with respect to module ``{item}``; thus removed from sub-query involving module ``{item}``.')
return [item for item in primary if not item in orphans]
#
valid_tables = [[item[0] for item in self.target_tables + self.condition_tables if item[0] in pipeline] for pipeline in pipelines]
# 1. Further filter pipelines to minimally match target table dependencies
Expand Down Expand Up @@ -491,4 +492,4 @@ def warn(self):
if __name__ == '__main__':
import sys
q = Query_Processor(sys.argv[1], [sys.argv[2]], [sys.argv[3]])
print(q.queries)
print(q.queries)

0 comments on commit 6baebf1

Please sign in to comment.