Repository: astronomer/astro-sdk

Issue:
Improve flow run output
**Describe the bug**
The current output of `flow run` is not compatible with what was specified in the original ticket #942.

**Version**
* SQL CLI: [0.0.7]

**To Reproduce**
```
$ flow run example_templating --env dev --project-dir=final

Created dagrun <DagRun example_templating @ 2022-10-19T13:25:14.278881+00:00: 
manual__2022-10-19T13:25:14.278881+00:00, state:running, queued_at: None. externally triggered: False> <DagRun 
example_templating @ 2022-10-19T13:25:14.278881+00:00: manual__2022-10-19T13:25:14.278881+00:00, state:running, 
queued_at: None. externally triggered: False>
*****************************************************
Running task filtered_orders
filtered_orders ran successfully!
*****************************************************
*****************************************************
Running task joint_orders_customers
joint_orders_customers ran successfully!
*****************************************************
Dagrun example_templating final state: success

```

**Expected behaviour**
Print something like:
```
Running the workflow example_imdb…

Processing popular_movies.sql to output_db.popular_movies SUCCESS 
Processing top_directors.sql to output_db.top_directors SUCCESS 
Completed successfully running the pipeline example_imdb
Total time:        3.218s
```


Discussion:

Resolving patch:
diff --git a/sql-cli/sql_cli/run_dag.py b/sql-cli/sql_cli/run_dag.py
--- a/sql-cli/sql_cli/run_dag.py
+++ b/sql-cli/sql_cli/run_dag.py
@@ -104,7 +104,9 @@ def run_dag(
                 add_logger_if_needed(dag, ti)
             ti.task = tasks[ti.task_id]
             _run_task(ti, session=session)
-    pprint(f"Dagrun {dr.dag_id} final state: {dr.state}")
+    pprint(f"Completed running the workflow {dr.dag_id}: [bold yellow][{dr.state.upper()}][/bold yellow]")
+    elapsed_seconds = (dr.end_date - dr.start_date).microseconds / 10**6
+    pprint(f"Total elapsed time: [bold blue]{elapsed_seconds:.2}s[/bold blue]")
     if conn_file_path or variable_file_path or connections:
         # Remove the local variables we have added to the secrets_backend_list
         secrets_backend_list.pop(0)  # noqa
@@ -136,20 +138,19 @@ def _run_task(ti: TaskInstance, session: Session) -> None:
 
     :param ti: TaskInstance to run
     """
-    pprint("[bold green]*****************************************************[/bold green]")
-    if hasattr(ti, "map_index") and ti.map_index > 0:
-        pprint("Running task %s index %d", ti.task_id, ti.map_index)
+    if ti.map_index >= 0:
+        pprint(f"Processing [bold yellow]{ti.task_id}[/bold yellow][{ti.map_index}]...", end=" ")
     else:
-        pprint(f"Running task [bold red]{ti.task_id}[/bold red]")
+        pprint(f"Processing [bold yellow]{ti.task_id}[/bold yellow]...", end=" ")
+
     try:
         warnings.filterwarnings(action="ignore")
         ti._run_raw_task(session=session)  # skipcq: PYL-W0212
         session.flush()
         session.commit()
-        pprint(f"[bold red]{ti.task_id}[/bold red] ran successfully!")
+        pprint("[bold green]SUCCESS[/bold green]")
     except AstroCleanupException:
         pprint("aql.cleanup async, continuing")
-    pprint("[bold green]*****************************************************[/bold green]")
 
 
 def _get_or_create_dagrun(
@@ -188,5 +189,5 @@ def _get_or_create_dagrun(
         session=session,
         conf=conf,  # type: ignore
     )
-    pprint(f"Created dagrun [bold blue]{str(dr)}[/bold blue]", str(dr))
+    pprint(f"\nRunning the workflow [bold blue]{dag.dag_id}[/bold blue]\n")
     return dr


Test patch:
diff --git a/sql-cli/tests/test___main__.py b/sql-cli/tests/test___main__.py
--- a/sql-cli/tests/test___main__.py
+++ b/sql-cli/tests/test___main__.py
@@ -95,7 +95,7 @@ def test_run(workflow_name, environment, initialised_project):
         print(result.output)
     assert result.exit_code == 0
     result_stdout = get_stdout(result)
-    assert f"Dagrun {workflow_name} final state: success" in result_stdout
+    assert f"Completed running the workflow {workflow_name}: [SUCCESS]" in result_stdout
 
 
 def test_init_with_directory(tmp_path):
diff --git a/sql-cli/tests/test_run_dag.py b/sql-cli/tests/test_run_dag.py
--- a/sql-cli/tests/test_run_dag.py
+++ b/sql-cli/tests/test_run_dag.py
@@ -19,7 +19,7 @@ def test_run_task_successfully(mock_session, mock_task_instance, capsys):
     mock_task_instance._run_raw_task.assert_called_once()
     mock_session.flush.assert_called_once()
     captured = capsys.readouterr()
-    assert "ran successfully!" in captured.out
+    assert "SUCCESS" in captured.out
 
 
 def test_run_task_cleanup_log(sample_dag, capsys):
@@ -53,7 +53,7 @@ def print_val(v):
     run_dag(sample_dag)
     captured = capsys.readouterr()
     for i in [1, 2]:
-        assert f"Running task %s index %d print_val {i}" in captured.out
+        assert f"Processing print_val[{i}]..." in captured.out
 
 
 def test_run_dag_with_skip(sample_dag, capsys):
@@ -77,9 +77,9 @@ def movie_ends():
         who_is_prettiest() >> [snow_white_wins(), witch_wins()] >> movie_ends()  # skipcq: PYL-W0106
     run_dag(sample_dag)
     captured = capsys.readouterr()
-    assert "witch_wins ran successfully!" not in captured.out
-    assert "snow_white_wins ran successfully!" in captured.out
-    assert "movie_ends ran successfully!" in captured.out
+    assert "Processing witch_wins... SUCCESS" not in captured.out
+    assert "Processing snow_white_wins... SUCCESS" in captured.out
+    assert "Processing movie_ends... SUCCESS" in captured.out
 
 
 def test_run_dag(capsys):