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

PTFM-36293 Fix potentially missing jobs in dx find --tree #1150

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Categories for each release: Added, Changed, Deprecated, Removed, Fixed, Securit
* `dx extract_assay` error message when no valid assay is found
* In `dx extract_assay germline`, handled duplicate RSIDs, output sorting order, changed location filter range from 250M to 5M
* Handled white spaces in `dx extract` command's inputs which are of the type `string` of comma separated values
* Potentially missing jobs in `dx find jobs/executions --tree` output

## [360.1] - beta

Expand Down
16 changes: 13 additions & 3 deletions src/python/dxpy/scripts/dx.py
Original file line number Diff line number Diff line change
Expand Up @@ -2297,6 +2297,7 @@ def process_tree(root_id, executions_by_parent, execution_descriptions, executio

try:
num_processed_results = 0
true_roots = []
roots = collections.OrderedDict()
execution_retries = collections.defaultdict(set)
executions_cache = []
Expand All @@ -2307,10 +2308,14 @@ def process_tree(root_id, executions_by_parent, execution_descriptions, executio
if args.trees:
if args.classname == 'job':
root = execution_result['describe']['originJob']
if execution_result['id'] == execution_result['describe']['originJob'] and root not in true_roots:
true_roots.append(root)
num_processed_results += 1
else:
root = execution_result['describe']['rootExecution']
if root not in roots:
num_processed_results += 1
if root not in true_roots:
true_roots.append(root)
num_processed_results += 1
else:
num_processed_results += 1
executions_cache.append(execution_result)
Expand Down Expand Up @@ -2414,7 +2419,12 @@ def process_execution_result(execution_result):
key=lambda root: -descriptions[ExecutionId(roots[root], execution_retries[roots[root]][-1])]['created']
)

for root in sorted_roots:
# PTFM-36293 In case we include tree only based on child matching the criteria, we can incorrectly report
# that there are no more results.
if len(sorted_roots) > args.num_results:
more_results = True

for root in sorted_roots[:args.num_results]:
process_tree(roots[root], executions_by_parent, descriptions, execution_retries)
if args.json:
print(json.dumps(json_output, indent=4))
Expand Down