[ https://issues.apache.org/jira/browse/BEAM-13636?focusedWorklogId=712040&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-712040 ]
ASF GitHub Bot logged work on BEAM-13636: ----------------------------------------- Author: ASF GitHub Bot Created on: 20/Jan/22 13:02 Start Date: 20/Jan/22 13:02 Worklog Time Spent: 10m Work Description: ilya-kozyrev commented on a change in pull request #16515: URL: https://github.com/apache/beam/pull/16515#discussion_r788739659 ########## File path: playground/infrastructure/ci_helper.py ########## @@ -97,5 +101,18 @@ async def _verify_examples_status(self, examples: List[Example]): "Number of Playground examples with some error: %s / %s", len(examples) - count_of_verified, len(examples)) - if verify_failed: + + if len(default_examples) != 1: + if len(default_examples) == 0: + logging.error("Default example not found") + elif len(default_examples) > 1: + logging.error("Many default examples found") + logging.error("Examples where the default_example field is true:") + for example in default_examples: + logging.error(example.filepath) + raise Exception( + "CI step failed due to finding an incorrect number of default examples" + ) Review comment: ```suggestion if len(default_examples) == 0: logging.error("Default example not found") raise Exception( "CI step failed due to finding an incorrect number of default examples. Default example not found") if len(default_examples) > 1: logging.error("Many default examples found") logging.error("Examples where the default_example field is true:") for example in default_examples: logging.error(example.filepath) raise Exception( "CI step failed due to finding an incorrect number of default examples. Many default examples found") ``` ########## File path: playground/infrastructure/ci_helper.py ########## @@ -97,5 +101,18 @@ async def _verify_examples_status(self, examples: List[Example]): "Number of Playground examples with some error: %s / %s", len(examples) - count_of_verified, len(examples)) - if verify_failed: + + if len(default_examples) != 1: Review comment: this if is redundant ########## File path: playground/infrastructure/helper.py ########## @@ -268,25 +270,28 @@ def _validate(tag: dict, supported_categories: List[str]) -> bool: In case tag is not valid, False """ valid = True + tag_fields = {f.default for f in fields(TagFields) + if f.default not in + {o_f.default for o_f in fields(OptionalTagFields)}} Review comment: Could you please name those variables more explicitly? ########## File path: playground/infrastructure/helper.py ########## @@ -268,25 +270,28 @@ def _validate(tag: dict, supported_categories: List[str]) -> bool: In case tag is not valid, False """ valid = True + tag_fields = {f.default for f in fields(TagFields) + if f.default not in + {o_f.default for o_f in fields(OptionalTagFields)}} # check that all fields exist and they have no empty value - for field in fields(TagFields): - if field.default not in tag: + for field in tag_fields: + if field not in tag: logging.error( "tag doesn't contain %s field: %s \n" "Please, check that this field exists in the beam playground tag." "If you are sure that this field exists in the tag" " check the format of indenting.", - field.default, + field, tag.__str__()) valid = False if valid is True: - value = tag.get(field.default) + value = tag.get(field) if (value == "" or - value is None) and field.default != TagFields.pipeline_options: + value is None) and field != TagFields.pipeline_options: logging.error( "tag's value is incorrect: %s\n%s field can not be empty.", tag.__str__(), - field.default.__str__()) + field.__str__()) Review comment: please use str cast instead of magic methods -- 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: github-unsubscr...@beam.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 712040) Time Spent: 1h (was: 50m) > Checking the default field on CI/CD step > ---------------------------------------- > > Key: BEAM-13636 > URL: https://issues.apache.org/jira/browse/BEAM-13636 > Project: Beam > Issue Type: Sub-task > Components: beam-playground > Reporter: Pavel Avilov > Assignee: Pavel Avilov > Priority: P2 > Labels: beam-playground-backend, beam-playground-sprint-7 > Time Spent: 1h > Remaining Estimate: 0h > > Need to add logic that will check that the examples of a specific SDK have > only 1 default example on CI/CD step. -- This message was sent by Atlassian Jira (v8.20.1#820001)