File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python
2+ # -*- coding: utf-8; -*-
3+
4+ # Copyright (c) 2023 Oracle and its affiliates.
5+ # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python
2+ # -*- coding: utf-8; -*-
3+
4+ # Copyright (c) 2023 Oracle and/or its affiliates.
5+ # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
6+
7+ from typing import Dict , Callable
8+ from functools import wraps
9+
10+ RUN_ID_FIELD = "run_id"
11+
12+ def print_watch_command (func : callable )-> Callable :
13+ """The decorator to help build the `opctl watch` command."""
14+ @wraps (func )
15+ def wrapper (* args , ** kwargs )-> Dict :
16+ result = func (* args , ** kwargs )
17+ if result and isinstance (result , Dict ) and RUN_ID_FIELD in result :
18+ msg_header = (
19+ f"{ '*' * 40 } To monitor the progress of a task, execute the following command { '*' * 40 } "
20+ )
21+ print (msg_header )
22+ print (f"ads opctl watch { result [RUN_ID_FIELD ]} " )
23+ print ("*" * len (msg_header ))
24+ return result
25+ return wrapper
You can’t perform that action at this time.
0 commit comments