pipe_dict = {}
try:
pipeline_list = KFCONNECT_KF_OBJ.get_kf_list_pipelines()
-
+ pipe_dict['next_page_token'] = pipeline_list.next_page_token
+ pipe_dict['total_size'] = pipeline_list.total_size
+
+ pipelines = []
for pipeline in pipeline_list.pipelines:
pipe_super_dict = {}
- pipe_param_dict = {}
- pipe_super_dict['id'] = pipeline.pipeline_id
+ pipe_super_dict['pipeline_id'] = pipeline.pipeline_id
+ pipe_super_dict['display_name'] = pipeline.display_name
pipe_super_dict['description'] = pipeline.description
- pipe_dict[pipeline.display_name] = pipe_super_dict
+ pipe_super_dict['created_at'] = pipeline.created_at
+ pipelines.append(pipe_super_dict)
+ pipe_dict['pipelines'] = pipelines
+
except:# pylint: disable=bare-except
tbk = traceback.format_exc()
LOGGER.error(tbk)
return jsonify(pipe_dict), status.HTTP_200_OK
+
@APP.route('/trainingjobs/<trainingjob_name>/execution', methods=['POST'])
def run_pipeline(trainingjob_name):
"""Function handling HTTP POST rest endpoint to execute pipeline based on trainingjob name
pipeline.pipeline_id = "pipeline-id"
pipeline.description = "pipeline-description"
pipeline.display_name= "pipeline-name"
+ pipeline.created_at = "created-at"
+
pipeline_list = ApiListPipelinesResponse()
pipeline_list.pipelines = [pipeline]
-
+ pipeline_list.next_page_token = "next-page-token"
+ pipeline_list.total_size = "total-size"
+
mock_get_kf_list_pipelines.return_value = pipeline_list
# when
mock_get_kf_list_pipelines.assert_called_once()
self.assertEqual(response.content_type, "application/json")
self.assertEqual(response.status_code, status.HTTP_200_OK)
- self.assertEqual(response.get_data(), b'{"pipeline-name":{"description":"pipeline-description","id":"pipeline-id"}}\n')
-
+ self.assertEqual(response.get_data(),
+ b'{"next_page_token":"next-page-token","pipelines":[{"created_at":"created-at","description":"pipeline-description","display_name":"pipeline-name","pipeline_id":"pipeline-id"}],"total_size":"total-size"}\n')
+
+
@patch("kfadapter.kfadapter_kfconnect.KfConnect.get_kf_pipeline_desc")
def test_get_pipeline(self, mock_get_kf_pipeline_desc):