|
5 | 5 | from planemo import options
|
6 | 6 | from planemo.cli import command_function
|
7 | 7 | from planemo.engine.factory import engine_context
|
8 |
| -from planemo.galaxy.invocations.progress import WorkflowProgress |
| 8 | +from planemo.galaxy.activity import wait_for_invocation_and_jobs |
9 | 9 |
|
10 | 10 |
|
11 | 11 | @click.command("workflow_track")
|
12 | 12 | @options.invocation_target_options()
|
13 | 13 | @command_function
|
14 | 14 | def cli(ctx, invocation_id, **kwds):
|
15 | 15 | """Run defined tests against existing workflow invocation."""
|
16 |
| - with WorkflowProgress() as workflow_progress: |
17 |
| - workflow_progress.add_bars() |
18 |
| - import time |
19 |
| - |
20 |
| - time.sleep(1) |
21 |
| - new_step = {"state": "new"} |
22 |
| - scheduled_step = {"state": "scheduled"} |
23 |
| - new_steps = [new_step, new_step, new_step] |
24 |
| - one_scheduled_steps = [scheduled_step, new_step, new_step] |
25 |
| - two_scheduled_steps = [scheduled_step, scheduled_step, new_step] |
26 |
| - all_scheduled_steps = [scheduled_step, scheduled_step, scheduled_step] |
27 |
| - state_pairs = [ |
28 |
| - ({"state": "new"}, {}), |
29 |
| - ({"state": "ready", "steps": new_steps}, {}), |
30 |
| - ({"state": "ready", "steps": one_scheduled_steps}, {"states": {"new": 1}}), |
31 |
| - ({"state": "ready", "steps": two_scheduled_steps}, {"states": {"new": 2}}), |
32 |
| - ({"state": "ready", "steps": two_scheduled_steps}, {"states": {"new": 1, "running": 1}}), |
33 |
| - ({"state": "ready", "steps": two_scheduled_steps}, {"states": {"new": 1, "ok": 1}}), |
34 |
| - ({"state": "ready", "steps": two_scheduled_steps}, {"states": {"ok": 2}}), |
35 |
| - ({"state": "scheduled", "steps": all_scheduled_steps}, {"states": {"ok": 2, "new": 3}}), |
36 |
| - ({"state": "scheduled", "steps": all_scheduled_steps}, {"states": {"ok": 2, "running": 1, "new": 2}}), |
37 |
| - ({"state": "scheduled", "steps": all_scheduled_steps}, {"states": {"ok": 3, "running": 1, "new": 1}}), |
38 |
| - ({"state": "scheduled", "steps": all_scheduled_steps}, {"states": {"ok": 4, "running": 1}}), |
39 |
| - ({"state": "scheduled", "steps": all_scheduled_steps}, {"states": {"ok": 5}}), |
40 |
| - ] |
41 |
| - for invocation, job_states_summary in state_pairs: |
42 |
| - workflow_progress.handle_invocation(invocation, job_states_summary) |
43 |
| - time.sleep(1) |
44 |
| - |
45 | 16 | with engine_context(ctx, engine="external_galaxy", **kwds) as engine, engine.ensure_runnables_served([]) as config:
|
46 | 17 | user_gi = config.user_gi
|
47 |
| - invocation = user_gi.invocations.show_invocation(invocation_id) |
48 |
| - # https://stackoverflow.com/questions/23113494/double-progress-bar-in-python |
| 18 | + wait_for_invocation_and_jobs( |
| 19 | + ctx, |
| 20 | + invocation_id, |
| 21 | + history_id=None, |
| 22 | + user_gi=user_gi, |
| 23 | + polling_backoff=5, |
| 24 | + ) |
49 | 25 |
|
50 | 26 | ctx.exit(0)
|
0 commit comments