Skip to content

Commit

Permalink
Sort taskProxies in cylc show
Browse files Browse the repository at this point in the history
It was possible for taskProxies when doing 'cylc show' to be in an odd order:

Task ID: 20240728T0000Z/b
Task ID: 20240727T0000Z/b
Task ID: 20240729T0000Z/b

After this change, they are always sorted by the ID of the task:

Task ID: 20240727T0000Z/b
Task ID: 20240728T0000Z/b
Task ID: 20240729T0000Z/b
  • Loading branch information
ColemanTom committed Aug 2, 2024
1 parent e2da477 commit 2a4401c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cylc/flow/scripts/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,10 @@ async def prereqs_and_outputs_query(
}
}
results = await pclient.async_request('graphql', tp_kwargs)
multi = len(results['taskProxies']) > 1
for t_proxy in results['taskProxies']:
task_proxies = sorted(results['taskProxies'],
key=lambda proxy: proxy['id'])
multi = len(task_proxies) > 1
for t_proxy in task_proxies:
task_id = Tokens(t_proxy['id']).relative_id
state = t_proxy['state']
if options.json:
Expand Down Expand Up @@ -379,7 +381,7 @@ async def prereqs_and_outputs_query(

print_completion_state(t_proxy)

if not results['taskProxies']:
if not task_proxies:
ansiprint(
f"<red>No matching active tasks found: {', '.join(ids_list)}",
file=sys.stderr)
Expand Down

0 comments on commit 2a4401c

Please sign in to comment.