damccorm commented on code in PR #24993:
URL: https://github.com/apache/beam/pull/24993#discussion_r1069593674


##########
playground/infrastructure/helper.py:
##########
@@ -188,13 +188,20 @@ def get_tag(filepath) -> Optional[Tag]:
         line[len(tag_prefix) :] for line in lines[line_start:line_finish]
     )
     yml = yaml.load(embdedded_yaml_content, Loader=yaml.SafeLoader)
-    return Tag(
-        filepath=filepath,
-        line_start=line_start,
-        line_finish=line_finish,
-        **yml[Config.BEAM_PLAYGROUND],
-    )
 
+    try:
+        return Tag(
+            filepath=str(filepath),
+            line_start=line_start,
+            line_finish=line_finish,
+            **yml[Config.BEAM_PLAYGROUND],
+            )
+    except pydantic.ValidationError as err:
+        if len(err.errors()) > 1:
+            raise
+        if err.errors()[0]["msg"] == "multifile is True but no files defined":
+            logging.warning("incomplete multifile example ignored %s", 
filepath)
+            return None

Review Comment:
   If this condition isn't true `err.errors()[0]["msg"] == "multifile is True 
but no files defined"` we still want to raise an exception, right?
   
   Should this just be:
   
   ```
           if len(err.errors()) == 1 and err.errors()[0]["msg"] == "multifile 
is True but no files defined":
               logging.warning("incomplete multifile example ignored %s", 
filepath)
               return None
           raise
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to