profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/dplute/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.
Daley Plute dplute DB-Engineering

google/digitalbuildings 191

Digital Buildings (ontology and SDK) currently being used by Google internally to manage our own buildings.

push eventDB-Engineering/digitalbuildings

Travis Welch

commit sha 69e62fab225ef8c30bde7af81746597281e8c67a

enhance explorer error messaging (#377) * enhance explorer error messaging * remove string type checks * fix linting errors

view details

Travis Welch

commit sha d610d82e5636762fa180280a2b858a8544a6985b

add arg_parser module to ontology_validator/ with tests (#379) * add arg_parser module to ontology_validator/ with tests * fix typo * fix more typos * minor fixes and readme update * minor changes * update readme Co-authored-by: Charbel kaed <charbelk@google.com>

view details

Charbel kaed

commit sha 81b47f4f674de24cfb4e13ed5c57f123c5df91a1

Revert "add arg_parser module to ontology_validator/ with tests (#379)" (#383) This reverts commit d610d82e5636762fa180280a2b858a8544a6985b.

view details

Daley Plute

commit sha 343e42926ce158f20764d4a3e014111e4290332c

Merge branch 'google:master' into validation-messages-update

view details

push time in a day

push eventDB-Engineering/digitalbuildings

Daley Plute

commit sha 5099ed2c9f58671266b26eecb4ad0e0aae20daac

Rewrite ontology validator messages. * Rename and reword many validation messages to be more descriptive. * Replace IllegalCharacterError with specific Invalid*NameErrors. * Rename 'context' attributes to 'file_context' for consistency. * Remove the unused CapitalizationError class.

view details

push time in a day

delete branch DB-Engineering/digitalbuildings

delete branch : output-results-to-file

delete time in 2 days

create barnchDB-Engineering/digitalbuildings

branch : validation-messages-update

created branch time in 2 days

pull request commentgoogle/digitalbuildings

Support writing instance validator results to file

@charbull I have added a test that uses the report file argument, and also adjusted the code to guarantee that the report file is closed when RunValidation exits and the original stdout is restored.

dplute

comment created time in 7 days

push eventDB-Engineering/digitalbuildings

Daley Plute

commit sha 0f61e5af2dbe2b284cf5bc80327d10196e753f92

Update instance validator report file handling

view details

push time in 7 days

PullRequestReviewEvent

push eventDB-Engineering/digitalbuildings

Daley Plute

commit sha 07482279587ddc7aed6462fb906e0c090de68c34

Revert "Update report file handling for linter." This reverts commit 6d9481e5509b8163ba692b46e590ca3046e8af68.

view details

Daley Plute

commit sha bbd07d19a8f54c621992e661cac16f93ea95e7b3

Disable lint message for output file opening

view details

push time in 7 days

Pull request review commentgoogle/digitalbuildings

Add main module to explorer

+"""Main module for DBO explorer."""+from lib import explorer+from lib import model++import pyfiglet++from absl import app+from absl import flags++FLAGS = flags.FLAGS+flags.DEFINE_string('alt', None, 'Path to an alternate ontology')+flags.DEFINE_boolean('debug', False, 'Produces debugging output')

You should be able to use def main(_): if the goal is accept an argument without the linter complaining about not using it.

trav3711

comment created time in 8 days

PullRequestReviewEvent

Pull request review commentgoogle/digitalbuildings

Support writing instance validator results to file

 class TelemetryHelper(object):   Attributes:     subscription: resource string referencing the subscription to check     service_account_file: path to file with service account information-    report_filename: a report filename provided by the user   """ -  def __init__(self, subscription, service_account_file, report_filename=None):+  def __init__(self, subscription, service_account_file):     super().__init__()-    self.report_filename = report_filename     self.subscription = subscription     self.service_account_file = service_account_file    def Validate(self, entities: Dict[str, entity_instance.EntityInstance],-               report_filename: str, timeout: int) -> None:+               timeout: int) -> None:     """Validates telemetry payload received from the subscription.      Args:       entities: EntityInstance dictionary keyed by entity name-      report_filename: path to write results to       timeout: number of seconds to wait for telemetry     """      print('Connecting to pubsub subscription: ', self.subscription)     sub = subscriber.Subscriber(self.subscription, self.service_account_file)     validator = telemetry_validator.TelemetryValidator(-        entities, timeout,-        self.BuildTelemetryValidationCallback(report_filename))+        entities, timeout, _TelemetryValidationCallback)     validator.StartTimer()     sub.Listen(validator.ValidateMessage) -  def BuildTelemetryValidationCallback(-      self,-      report_filename: Optional[str] = None-  ) -> Callable[[telemetry_validator.TelemetryValidator], None]:-    """Returns a callback to be called when a telemetry message is received. -    Args:-      report_filename: path to write results to-    """+def _TelemetryValidationCallback(

Yes, it can be at the module level now because it no longer needs any references to the file path or the telemetry helper.

dplute

comment created time in 8 days

PullRequestReviewEvent

Pull request review commentgoogle/digitalbuildings

Support writing instance validator results to file

 def _ParseArgs() -> argparse.ArgumentParser:  if __name__ == '__main__':   args = _ParseArgs().parse_args(sys.argv[1:])-  handler.RunValidation(-      filenames=args.filenames,-      modified_types_filepath=args.modified_types_filepath,-      subscription=args.subscription,-      service_account=args.service_account,-      report_filename=args.report_filename,-      timeout=int(args.timeout))++  if args.report_filename:+    with open(args.report_filename, 'w', encoding='utf-8') as sys.stdout:+      handler.RunValidation(+          filenames=args.filenames,+          modified_types_filepath=args.modified_types_filepath,+          subscription=args.subscription,+          service_account=args.service_account,+          timeout=int(args.timeout))+  else:+    handler.RunValidation(+        filenames=args.filenames,+        modified_types_filepath=args.modified_types_filepath,+        subscription=args.subscription,+        service_account=args.service_account,+        timeout=int(args.timeout))

That's what we were discussing above. I initially had it conditionally assign sys.stdout = open(...) if a file path was provided, but the linter rejected the use of "open" outside of a "with" block and I can't think of a way to use a "with" block without at least duplicating a call.

dplute

comment created time in 8 days

PullRequestReviewEvent

Pull request review commentgoogle/digitalbuildings

Aggregation Descriptor Ontology Validator Update

 from yamlformat.validator import subfield_lib  AGGREGATION = subfield_lib.SubfieldCategory.AGGREGATION+AGGREGATION_DESCRIPTOR = subfield_lib.SubfieldCategory.AGGREGATION_DESCRIPTOR

That actually sounds like something we should add as a validation check, and the same for measurement descriptors.

The GitHub app is giving me conflicting info on whether or not I can push directly to this branch, so if you want me to take over writing tests, I may need to do it on a separate PR.

tasodorff

comment created time in 8 days

PullRequestReviewEvent

pull request commentgoogle/digitalbuildings

Support writing instance validator results to file

I'm not crazy about duplicating the RunValidation call just to silence the linter, but the latest commit passes.

dplute

comment created time in 8 days

Pull request review commentgoogle/digitalbuildings

Support writing instance validator results to file

 def RunValidation(filenames: List[str],                   report_filename: str = None,                   timeout: int = 60) -> None:   """Master runner for all validations."""+  if report_filename:+    sys.stdout = open(report_filename, 'w', encoding='utf-8')

The problem there is that the contents of RunValidation would need to be inside the 'with' block, which needs to be within the 'if' block.

dplute

comment created time in 8 days

PullRequestReviewEvent

push eventDB-Engineering/digitalbuildings

Daley Plute

commit sha 6d9481e5509b8163ba692b46e590ca3046e8af68

Update report file handling for linter.

view details

push time in 8 days

push eventDB-Engineering/digitalbuildings

Daley Plute

commit sha 0d342b6443030c30a9d3ecc49a323bb0f8aaa425

Cleanup unused imports

view details

push time in 8 days

Pull request review commentgoogle/digitalbuildings

Aggregation Descriptor Ontology Validator Update

 def __init__(self):   _CATEGORIES_IN_ORDER = [       _CAT_SPEC(           cat=subfield_lib.SubfieldCategory.AGGREGATION, required=False, max=1),+      _CAT_SPEC(+          cat=subfield_lib.SubfieldCategory.AGGREGATION_DESCRIPTOR, required=False, max=10),

Is there a need for allowing up to 10 aggregation descriptors in one field? From what I recall, the descriptors will only represent duration, and those should all be mutually exclusive.

tasodorff

comment created time in 8 days

Pull request review commentgoogle/digitalbuildings

Aggregation Descriptor Ontology Validator Update

 from yamlformat.validator import subfield_lib  AGGREGATION = subfield_lib.SubfieldCategory.AGGREGATION+AGGREGATION_DESCRIPTOR = subfield_lib.SubfieldCategory.AGGREGATION_DESCRIPTOR

We should add and/or modify field tests to use the new subfield category.

tasodorff

comment created time in 8 days

Pull request review commentgoogle/digitalbuildings

Aggregation Descriptor Ontology Validator Update

 def testAddFromConfig(self):     sff = subfield_lib.SubfieldFolder(_GOOD_PATH)     sff.AddFromConfig([doc], '{0}/file.yaml'.format(_GOOD_PATH))     ns = sff.local_namespace--    self.assertCountEqual(['agg', 'comp', 'desc', 'mdesc', 'meas', 'ptype'],+    self.assertCountEqual(['agg','aggdesc', 'comp', 'desc', 'mdesc', 'meas', 'ptype'],
    self.assertCountEqual(['agg', 'aggdesc', 'comp', 'desc', 'mdesc', 'meas', 'ptype'],

This line is too long, but I'm not sure what the preferred or linter-approved way to split it is.

tasodorff

comment created time in 8 days

Pull request review commentgoogle/digitalbuildings

Aggregation Descriptor Ontology Validator Update

 def testAddFromConfig(self):         'aggregation': {             'agg': 'aggD'         },+        'aggregation_descriptor':{+            'aggdesc':'aggDescD'
            'aggdesc': 'aggDescD'
tasodorff

comment created time in 8 days

PullRequestReviewEvent
PullRequestReviewEvent

pull request commentgoogle/digitalbuildings

Support writing instance validator results to file

Does anyone have suggestions on dealing with the consider-using-with lint error? A 'with' block is not really appropriate here since we are not always opening a file, and we're letting python manage it as a replacement stdout.

dplute

comment created time in 8 days

push eventDB-Engineering/digitalbuildings

Daley Plute

commit sha a975779587bc0e981b02f92762d795ae2d29e741

Update instance validator readme for report arg

view details

push time in 8 days

PR opened google/digitalbuildings

Support writing instance validator results to file

This update changes the behavior of the existing --report_filename argument so that the report file will contain all output messages from both instance validation and telemetry validation, instead of just telemetry.

I have moved the telemetry callback to the module scope and removed BuildTelemetryValidationCallback because there is no longer any need for the callback to be a closure.

+43 -62

0 comment

1 changed file

pr created time in 8 days