You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by pa...@apache.org on 2022/02/07 21:28:19 UTC

[beam] branch master updated: Merge pull request #16754 from [BEAM-13838][Playground] Add logs in case of empty graph for CD step

This is an automated email from the ASF dual-hosted git repository.

pabloem pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/master by this push:
     new bb15d18  Merge pull request #16754 from [BEAM-13838][Playground] Add logs in case of empty graph for CD step
bb15d18 is described below

commit bb15d1896a2972bb6b95eaa28408345ac8c27b50
Author: Aydar Zainutdinov <ay...@akvelon.com>
AuthorDate: Tue Feb 8 00:27:11 2022 +0300

    Merge pull request #16754 from [BEAM-13838][Playground] Add logs in case of empty graph for CD step
    
    * [BEAM-13838][Playground]
    Add logs for CD step
    
    * [BEAM-13838][Playground]
    Fix typos
---
 playground/infrastructure/cd_helper.py   |  5 ++++-
 playground/infrastructure/grpc_client.py |  9 ++++++---
 playground/infrastructure/helper.py      | 17 +++++++++--------
 3 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/playground/infrastructure/cd_helper.py b/playground/infrastructure/cd_helper.py
index e2e8599..5797b1f 100644
--- a/playground/infrastructure/cd_helper.py
+++ b/playground/infrastructure/cd_helper.py
@@ -79,7 +79,10 @@ class CDHelper:
 
     if len(examples) > 0 and (examples[0].sdk is SDK_PYTHON or
                               examples[0].sdk is SDK_JAVA):
-      tasks = [client.get_graph(example.pipeline_id) for example in examples]
+      tasks = [
+          client.get_graph(example.pipeline_id, example.filepath)
+          for example in examples
+      ]
       graphs = await asyncio.gather(*tasks)
 
       for graph, example in zip(graphs, examples):
diff --git a/playground/infrastructure/grpc_client.py b/playground/infrastructure/grpc_client.py
index ddd9152..40543d5 100644
--- a/playground/infrastructure/grpc_client.py
+++ b/playground/infrastructure/grpc_client.py
@@ -16,7 +16,7 @@
 """
 Module contains the client to communicate with GRPC test Playground server
 """
-
+import logging
 import uuid
 
 import grpc
@@ -130,12 +130,13 @@ class GRPCClient:
     response = await self._stub.GetCompileOutput(request)
     return response.output
 
-  async def get_graph(self, pipeline_uuid: str) -> str:
+  async def get_graph(self, pipeline_uuid: str, example_filepath: str) -> str:
     """
     Get the graph of pipeline execution.
 
     Args:
         pipeline_uuid: uuid of the pipeline
+        example_filepath: path to the file of the example
 
     Returns:
         graph: contain the graph of pipeline execution as a string
@@ -144,9 +145,11 @@ class GRPCClient:
     request = api_pb2.GetGraphRequest(pipeline_uuid=pipeline_uuid)
     try:
       response = await self._stub.GetGraph(request)
+      if response.graph == "":
+        logging.warning("Graph for %s wasn't generated", example_filepath)
       return response.graph
     except grpc.RpcError:
-      # Some examples doesn't have graph (katas)
+      logging.warning("Graph for %s wasn't generated", example_filepath)
       return ""
 
   def _verify_pipeline_uuid(self, pipeline_uuid):
diff --git a/playground/infrastructure/helper.py b/playground/infrastructure/helper.py
index f90cd87..8dd606a 100644
--- a/playground/infrastructure/helper.py
+++ b/playground/infrastructure/helper.py
@@ -46,7 +46,8 @@ Tag = namedtuple(
         TagFields.pipeline_options,
         TagFields.default_example,
         TagFields.context_line
-    ], defaults=(None, None, False, None, None, False, None))
+    ],
+    defaults=(None, None, False, None, None, False, None))
 
 
 @dataclass
@@ -341,13 +342,13 @@ def _validate(tag: dict, supported_categories: List[str]) -> bool:
   # check that context line's value is integer
   context_line = tag.get(TagFields.context_line)
   if not isinstance(context_line, int):
-      logging.error(
-          "tag's field context_line is incorrect: %s \n"
-          "context_line variable should be integer format, "
-          "but tag contains: %s",
-          tag,
-          context_line)
-      valid = False
+    logging.error(
+        "Tag's field context_line is incorrect: %s \n"
+        "context_line variable should be integer format, "
+        "but tag contains: %s",
+        tag,
+        context_line)
+    valid = False
   return valid