Skip to content

Commit 498b807

Browse files
tomvdwThe TensorFlow Datasets Authors
authored andcommitted
Fixed missing proto issue for smart buildings dataset. As discussed with @weide the fix is to:
1. Move protos to the dedicated proto directory 2. Include the generated compiled files using the protoc command I also created folders in the test data for all years, with a dummy file that will be ignored. This still needs external testing to verify PiperOrigin-RevId: 695326848
1 parent b26655e commit 498b807

13 files changed

+314
-18
lines changed

tensorflow_datasets/datasets/smart_buildings/controller_reader.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,9 @@
2525
import pandas as pd
2626
from tensorflow_datasets.datasets.smart_buildings import constants
2727
from tensorflow_datasets.datasets.smart_buildings import reader_lib
28-
from tensorflow_datasets.datasets.smart_buildings import smart_control_building_pb2
29-
from tensorflow_datasets.datasets.smart_buildings import smart_control_normalization_pb2
30-
from tensorflow_datasets.datasets.smart_buildings import smart_control_reward_pb2
31-
28+
from tensorflow_datasets.proto import smart_control_building_generated_pb2 as smart_control_building_pb2
29+
from tensorflow_datasets.proto import smart_control_normalization_generated_pb2 as smart_control_normalization_pb2
30+
from tensorflow_datasets.proto import smart_control_reward_generated_pb2 as smart_control_reward_pb2
3231

3332
T = TypeVar('T')
3433

tensorflow_datasets/datasets/smart_buildings/dummy_data/dataset/SB1/19/_dummy

Whitespace-only changes.

tensorflow_datasets/datasets/smart_buildings/dummy_data/dataset/SB1/20/_dummy

Whitespace-only changes.

tensorflow_datasets/datasets/smart_buildings/dummy_data/dataset/SB1/21/_dummy

Whitespace-only changes.

tensorflow_datasets/datasets/smart_buildings/dummy_data/dataset/SB1/22/_dummy

Whitespace-only changes.

tensorflow_datasets/datasets/smart_buildings/reader_lib.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636

3737
from absl import logging
3838
import pandas as pd
39-
from tensorflow_datasets.datasets.smart_buildings import smart_control_building_pb2
40-
from tensorflow_datasets.datasets.smart_buildings import smart_control_normalization_pb2
41-
from tensorflow_datasets.datasets.smart_buildings import smart_control_reward_pb2
39+
from tensorflow_datasets.proto import smart_control_building_generated_pb2 as smart_control_building_pb2
40+
from tensorflow_datasets.proto import smart_control_normalization_generated_pb2 as smart_control_normalization_pb2
41+
from tensorflow_datasets.proto import smart_control_reward_generated_pb2 as smart_control_reward_pb2
4242

4343
VariableId = NewType('VariableId', str)
4444

tensorflow_datasets/datasets/smart_buildings/smart_buildings_dataset_builder_test.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,23 @@
1515

1616
"""smart_buildings_dataset dataset."""
1717

18-
# from tensorflow_datasets.datasets.smart_buildings
19-
# import smart_buildingsdataset_builder
20-
# import tensorflow_datasets.public_api as tfds
18+
from tensorflow_datasets.datasets.smart_buildings import smart_buildings_dataset_builder
19+
import tensorflow_datasets.public_api as tfds
2120

2221

23-
# class SmartBuildingsDatasetTest(tfds.testing.DatasetBuilderTestCase):
24-
# """Tests for smart_buildings_dataset dataset."""
22+
class SmartBuildingsDatasetTest(tfds.testing.DatasetBuilderTestCase):
23+
"""Tests for smart_buildings_dataset dataset."""
24+
25+
DATASET_CLASS = smart_buildings_dataset_builder.Builder
26+
SPLITS = {
27+
'sb1_19': 12, # Number of fake train examples
28+
'sb1_20': 12, # Number of fake train examples
29+
'sb1_21': 12, # Number of fake train examples
30+
'sb1_22': 12, # Number of fake train examples
31+
'sb1_23': 12, # Number of fake train examples
32+
'sb1_24': 12, # Number of fake train examples
33+
}
2534

26-
# DATASET_CLASS = smart_buildings_dataset_dataset_builder.Builder
27-
# SPLITS = {
28-
# 'sb1_23': 12, # Number of fake train example
29-
# 'sb1_24': 12, # Number of fake train example
30-
# }
3135

3236
# If you are calling `download/download_and_extract` with a dict, like:
3337
# dl_manager.download({'some_key': 'http://a.org/out.txt', ...})
@@ -37,4 +41,4 @@
3741

3842

3943
if __name__ == '__main__':
40-
pass # tfds.testing.test_main()
44+
tfds.testing.test_main()
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# coding=utf-8
2+
# Copyright 2024 The TensorFlow Datasets Authors.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
# pylint: skip-file
17+
18+
# -*- coding: utf-8 -*-
19+
# Generated by the protocol buffer compiler. DO NOT EDIT!
20+
# source: smart_control_building.proto
21+
"""Generated protocol buffer code."""
22+
from google.protobuf import descriptor as _descriptor
23+
from google.protobuf import descriptor_pool as _descriptor_pool
24+
from google.protobuf import symbol_database as _symbol_database
25+
from google.protobuf.internal import builder as _builder
26+
# @@protoc_insertion_point(imports)
27+
28+
_sym_db = _symbol_database.Default()
29+
30+
31+
from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2
32+
33+
34+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(
35+
b'\n\x1csmart_control_building.proto\x12#smart_buildings.smart_control.proto\x1a\x1fgoogle/protobuf/timestamp.proto"\xfe\x01\n\x08ZoneInfo\x12\x0f\n\x07zone_id\x18\x01'
36+
b' \x01(\t\x12\x13\n\x0b\x62uilding_id\x18\x02'
37+
b' \x01(\t\x12\x18\n\x10zone_description\x18\x03'
38+
b' \x01(\t\x12\x0c\n\x04\x61rea\x18\x04'
39+
b' \x01(\x02\x12\x0f\n\x07\x64\x65vices\x18\x05'
40+
b' \x03(\t\x12I\n\tzone_type\x18\x06'
41+
b' \x01(\x0e\x32\x36.smart_buildings.smart_control.proto.ZoneInfo.ZoneType\x12\r\n\x05\x66loor\x18\x07'
42+
b' \x01(\x05"9\n\x08ZoneType\x12\r\n\tUNDEFINED\x10\x00\x12\x08\n\x04ROOM\x10\x01\x12\t\n\x05\x46LOOR\x10\x02\x12\t\n\x05OTHER\x10\n"\xa5\x07\n\nDeviceInfo\x12\x11\n\tdevice_id\x18\x01'
43+
b' \x01(\t\x12\x11\n\tnamespace\x18\x02'
44+
b' \x01(\t\x12\x0c\n\x04\x63ode\x18\x03'
45+
b' \x01(\t\x12\x0f\n\x07zone_id\x18\x04'
46+
b' \x01(\t\x12O\n\x0b\x64\x65vice_type\x18\x05'
47+
b' \x01(\x0e\x32:.smart_buildings.smart_control.proto.DeviceInfo.DeviceType\x12`\n\x11observable_fields\x18\x06'
48+
b' \x03(\x0b\x32\x45.smart_buildings.smart_control.proto.DeviceInfo.ObservableFieldsEntry\x12X\n\raction_fields\x18\x07'
49+
b' \x03(\x0b\x32\x41.smart_buildings.smart_control.proto.DeviceInfo.ActionFieldsEntry\x1ar\n\x15ObservableFieldsEntry\x12\x0b\n\x03key\x18\x01'
50+
b' \x01(\t\x12H\n\x05value\x18\x02'
51+
b' \x01(\x0e\x32\x39.smart_buildings.smart_control.proto.DeviceInfo.ValueType:\x02\x38\x01\x1an\n\x11\x41\x63tionFieldsEntry\x12\x0b\n\x03key\x18\x01'
52+
b' \x01(\t\x12H\n\x05value\x18\x02'
53+
b' \x01(\x0e\x32\x39.smart_buildings.smart_control.proto.DeviceInfo.ValueType:\x02\x38\x01"\xe7\x01\n\nDeviceType\x12\r\n\tUNDEFINED\x10\x00\x12\x07\n\x03\x46\x41N\x10\x01\x12\x07\n\x03PMP\x10\x02\x12\x07\n\x03\x46\x43U\x10\x03\x12\x07\n\x03VAV\x10\x04\x12\x06\n\x02\x44H\x10\x05\x12\x07\n\x03\x41HU\x10\x06\x12\x07\n\x03\x42LR\x10\x07\x12\x08\n\x04\x43\x44WS\x10\x08\x12\x06\n\x02\x43H\x10\t\x12\x08\n\x04\x43HWS\x10\n\x12\x06\n\x02\x43T\x10\x0b\x12\x06\n\x02\x44\x43\x10\x0c\x12\x07\n\x03\x44\x46R\x10\r\x12\x07\n\x03\x44MP\x10\x0e\x12\x07\n\x03HWS\x10\x0f\x12\x06\n\x02HX\x10\x10\x12\x07\n\x03MAU\x10\x11\x12\x07\n\x03SDC\x10\x12\x12\x06\n\x02UH\x10\x13\x12\x07\n\x03PWR\x10\x14\x12\x07\n\x03GAS\x10\x15\x12\x06\n\x02\x41\x43\x10\x16\x12\t\n\x05OTHER\x10\x17"w\n\tValueType\x12\x18\n\x14VALUE_TYPE_UNDEFINED\x10\x00\x12\x14\n\x10VALUE_CONTINUOUS\x10\x01\x12\x11\n\rVALUE_INTEGER\x10\x02\x12\x15\n\x11VALUE_CATEGORICAL\x10\x03\x12\x10\n\x0cVALUE_BINARY\x10\x04"G\n\x18SingleObservationRequest\x12\x11\n\tdevice_id\x18\x01'
54+
b' \x01(\t\x12\x18\n\x10measurement_name\x18\x02'
55+
b' \x01(\t"\xdf\x02\n\x19SingleObservationResponse\x12-\n\ttimestamp\x18\x01'
56+
b' \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x61\n\x1asingle_observation_request\x18\x02'
57+
b' \x01(\x0b\x32=.smart_buildings.smart_control.proto.SingleObservationRequest\x12\x19\n\x11observation_valid\x18\x03'
58+
b' \x01(\x08\x12\x1a\n\x10\x63ontinuous_value\x18\x04'
59+
b' \x01(\x02H\x00\x12\x17\n\rinteger_value\x18\x05'
60+
b' \x01(\x05H\x00\x12\x1b\n\x11\x63\x61tegorical_value\x18\x06'
61+
b' \x01(\tH\x00\x12\x16\n\x0c\x62inary_value\x18\x07'
62+
b' \x01(\x08H\x00\x12\x16\n\x0cstring_value\x18\x08'
63+
b' \x01(\tH\x00\x42\x13\n\x11observation_value"\xa7\x01\n\x12ObservationRequest\x12-\n\ttimestamp\x18\x01'
64+
b' \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x62\n\x1bsingle_observation_requests\x18\x02'
65+
b' \x03(\x0b\x32=.smart_buildings.smart_control.proto.SingleObservationRequest"\xf4\x01\n\x13ObservationResponse\x12-\n\ttimestamp\x18\x01'
66+
b' \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12H\n\x07request\x18\x02'
67+
b' \x01(\x0b\x32\x37.smart_buildings.smart_control.proto.ObservationRequest\x12\x64\n\x1csingle_observation_responses\x18\x03'
68+
b' \x03(\x0b\x32>.smart_buildings.smart_control.proto.SingleObservationResponse"\xd3\x01\n\x13SingleActionRequest\x12\x11\n\tdevice_id\x18\x01'
69+
b' \x01(\t\x12\x15\n\rsetpoint_name\x18\x02'
70+
b' \x01(\t\x12\x1a\n\x10\x63ontinuous_value\x18\x03'
71+
b' \x01(\x02H\x00\x12\x17\n\rinteger_value\x18\x04'
72+
b' \x01(\x05H\x00\x12\x1b\n\x11\x63\x61tegorical_value\x18\x05'
73+
b' \x01(\tH\x00\x12\x16\n\x0c\x62inary_value\x18\x06'
74+
b' \x01(\x08H\x00\x12\x16\n\x0cstring_value\x18\x07'
75+
b' \x01(\tH\x00\x42\x10\n\x0esetpoint_value"\xdd\x03\n\x14SingleActionResponse\x12I\n\x07request\x18\x01'
76+
b' \x01(\x0b\x32\x38.smart_buildings.smart_control.proto.SingleActionRequest\x12\x63\n\rresponse_type\x18\x02'
77+
b' \x01(\x0e\x32L.smart_buildings.smart_control.proto.SingleActionResponse.ActionResponseType\x12\x17\n\x0f\x61\x64\x64itional_info\x18\x03'
78+
b' \x01(\t"\xfb\x01\n\x12\x41\x63tionResponseType\x12\r\n\tUNDEFINED\x10\x00\x12\x0c\n\x08\x41\x43\x43\x45PTED\x10\x01\x12\x0b\n\x07PENDING\x10\x02\x12\r\n\tTIMED_OUT\x10\x03\x12\x1c\n\x18REJECTED_INVALID_SETTING\x10\x04\x12%\n!REJECTED_NOT_ENABLED_OR_AVAILABLE\x10\x05\x12\x15\n\x11REJECTED_OVERRIDE\x10\x06\x12\x1b\n\x17REJECTED_INVALID_DEVICE\x10\x07\x12\x1b\n\x17REJECTED_DEVICE_OFFLINE\x10\x08\x12\x0b\n\x07UNKNOWN\x10\t\x12\t\n\x05OTHER\x10\n"\x98\x01\n\rActionRequest\x12-\n\ttimestamp\x18\x01'
79+
b' \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12X\n\x16single_action_requests\x18\x02'
80+
b' \x03(\x0b\x32\x38.smart_buildings.smart_control.proto.SingleActionRequest"\xe0\x01\n\x0e\x41\x63tionResponse\x12-\n\ttimestamp\x18\x01'
81+
b' \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x43\n\x07request\x18\x02'
82+
b' \x01(\x0b\x32\x32.smart_buildings.smart_control.proto.ActionRequest\x12Z\n\x17single_action_responses\x18\x03'
83+
b' \x03(\x0b\x32\x39.smart_buildings.smart_control.proto.SingleActionResponseb\x06proto3'
84+
)
85+
86+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
87+
_builder.BuildTopDescriptorsAndMessages(
88+
DESCRIPTOR, 'smart_control_building_pb2', globals()
89+
)
90+
if _descriptor._USE_C_DESCRIPTORS == False:
91+
92+
DESCRIPTOR._options = None
93+
_DEVICEINFO_OBSERVABLEFIELDSENTRY._options = None
94+
_DEVICEINFO_OBSERVABLEFIELDSENTRY._serialized_options = b'8\001'
95+
_DEVICEINFO_ACTIONFIELDSENTRY._options = None
96+
_DEVICEINFO_ACTIONFIELDSENTRY._serialized_options = b'8\001'
97+
_ZONEINFO._serialized_start = 103
98+
_ZONEINFO._serialized_end = 357
99+
_ZONEINFO_ZONETYPE._serialized_start = 300
100+
_ZONEINFO_ZONETYPE._serialized_end = 357
101+
_DEVICEINFO._serialized_start = 360
102+
_DEVICEINFO._serialized_end = 1293
103+
_DEVICEINFO_OBSERVABLEFIELDSENTRY._serialized_start = 712
104+
_DEVICEINFO_OBSERVABLEFIELDSENTRY._serialized_end = 826
105+
_DEVICEINFO_ACTIONFIELDSENTRY._serialized_start = 828
106+
_DEVICEINFO_ACTIONFIELDSENTRY._serialized_end = 938
107+
_DEVICEINFO_DEVICETYPE._serialized_start = 941
108+
_DEVICEINFO_DEVICETYPE._serialized_end = 1172
109+
_DEVICEINFO_VALUETYPE._serialized_start = 1174
110+
_DEVICEINFO_VALUETYPE._serialized_end = 1293
111+
_SINGLEOBSERVATIONREQUEST._serialized_start = 1295
112+
_SINGLEOBSERVATIONREQUEST._serialized_end = 1366
113+
_SINGLEOBSERVATIONRESPONSE._serialized_start = 1369
114+
_SINGLEOBSERVATIONRESPONSE._serialized_end = 1720
115+
_OBSERVATIONREQUEST._serialized_start = 1723
116+
_OBSERVATIONREQUEST._serialized_end = 1890
117+
_OBSERVATIONRESPONSE._serialized_start = 1893
118+
_OBSERVATIONRESPONSE._serialized_end = 2137
119+
_SINGLEACTIONREQUEST._serialized_start = 2140
120+
_SINGLEACTIONREQUEST._serialized_end = 2351
121+
_SINGLEACTIONRESPONSE._serialized_start = 2354
122+
_SINGLEACTIONRESPONSE._serialized_end = 2831
123+
_SINGLEACTIONRESPONSE_ACTIONRESPONSETYPE._serialized_start = 2580
124+
_SINGLEACTIONRESPONSE_ACTIONRESPONSETYPE._serialized_end = 2831
125+
_ACTIONREQUEST._serialized_start = 2834
126+
_ACTIONREQUEST._serialized_end = 2986
127+
_ACTIONRESPONSE._serialized_start = 2989
128+
_ACTIONRESPONSE._serialized_end = 3213
129+
# @@protoc_insertion_point(module_scope)

0 commit comments

Comments
 (0)