@@ -22,7 +22,7 @@ def _log_object(self, instance):
22
22
if instance is None :
23
23
self .logger .warning ("Not found" )
24
24
return
25
-
25
+
26
26
json_formatted_str = json .dumps (instance , indent = 4 )
27
27
print (json_formatted_str )
28
28
@@ -54,25 +54,29 @@ def execute(self, name, project_id):
54
54
55
55
return workflow
56
56
57
+
57
58
class CreateWorkflowRunCommand (BaseWorkflowCommand ):
58
59
def execute (self , spec_path = None , input_path = None , workflow_id = None , cluster_id = None ):
59
60
spec = None
60
61
inputs = None
61
62
if spec_path :
62
63
if not os .path .exists (spec_path ):
63
- raise ApplicationError ('Source path not found: {}' .format (spec_path ))
64
+ raise ApplicationError (
65
+ 'Source path not found: {}' .format (spec_path ))
64
66
else :
65
67
yaml_spec = open (spec_path , 'r' )
66
68
spec = yaml .safe_load (yaml_spec )
67
69
68
70
if input_path :
69
71
if not os .path .exists (input_path ):
70
- raise ApplicationError ('Source path not found: {}' .format (input_path ))
72
+ raise ApplicationError (
73
+ 'Source path not found: {}' .format (input_path ))
71
74
else :
72
75
yaml_inputs = open (input_path , 'r' )
73
76
inputs = yaml .safe_load (yaml_inputs )
74
77
75
- workflow = self .client .run_workflow (spec = spec , inputs = inputs , workflow_id = workflow_id , cluster_id = cluster_id )
78
+ workflow = self .client .run_workflow (
79
+ spec = spec , inputs = inputs , workflow_id = workflow_id , cluster_id = cluster_id )
76
80
return workflow
77
81
78
82
@@ -90,18 +94,20 @@ def _get_table_data(self, objects):
90
94
))
91
95
return data
92
96
97
+
93
98
class ListWorkflowRunsCommand (ListCommandMixin , BaseWorkflowCommand ):
94
99
def _get_instances (self , kwargs ):
95
100
instances = self .client .list_runs (** kwargs )
96
101
return instances
97
-
102
+
98
103
def _get_table_data (self , objects ):
99
- data = [('Run' , 'Cluster ID' , 'Status' )]
104
+ data = [('Run' , 'Cluster ID' , 'Status' , 'Log ID' )]
100
105
for workflow_run in objects :
101
106
data .append ((
102
107
workflow_run ['id' ],
103
108
workflow_run ['cluster' ]['id' ],
104
109
workflow_run ['status' ]['phase' ],
110
+ workflow_run ['status' ]['logId' ],
105
111
))
106
112
return data
107
113
@@ -117,6 +123,7 @@ def get_instance(self, workflow_id):
117
123
instance = self .client .get (workflow_id = workflow_id )
118
124
return instance
119
125
126
+
120
127
class GetWorkflowRunCommand (DetailJSONCommandMixin , BaseWorkflowCommand ):
121
128
def execute (self , workflow_id , run ):
122
129
with halo .Halo (text = self .WAITING_FOR_RESPONSE_MESSAGE , spinner = "dots" ):
@@ -128,6 +135,6 @@ def get_instance(self, workflow_id, run):
128
135
instance = self .client .get_run (workflow_id = workflow_id , run = run )
129
136
return instance
130
137
138
+
131
139
class WorkflowLogsCommand (LogsCommandMixin , BaseWorkflowCommand ):
132
140
ENTITY = "Workflows"
133
-
0 commit comments