Skip to content

Commit

Permalink
Expose rules for abesim_data_loader.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 345717338
  • Loading branch information
syshafi authored and copybara-github committed Dec 4, 2020
1 parent 959304f commit edd6e34
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@ RUN apt-get --no-install-recommends -y install ca-certificates clang curl gnupg
RUN echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list \
&& curl https://bazel.build/bazel-release.pub.gpg | apt-key add -
RUN apt-get -y update
RUN apt-get --no-install-recommends -y install bazel python3 python-is-python3 python3-distutils
RUN apt-get --no-install-recommends -y install bazel python3 python-is-python3 \
python3-distutils python3-dev python3-pip
RUN pip3 install numpy
RUN printf "startup --output_user_root=/tmp/bazel_output\n" > /root/.bazelrc
27 changes: 27 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@ http_archive(
strip_prefix = "abseil-cpp-master",
)

http_archive(
name = "six_archive",
build_file = "//third_party:six.BUILD",
sha256 = "d16a0141ec1a18405cd4ce8b4613101da75da0e9a7aec5bdd4fa804d0e0eba73",
strip_prefix = "six-1.12.0",
urls = [
"http://mirror.bazel.build/pypi.python.org/packages/source/s/six/six-1.12.0.tar.gz",
"https://pypi.python.org/packages/source/s/six/six-1.12.0.tar.gz", # 2018-12-10
],
)

http_archive(
name = "com_google_riegeli",
urls = ["https://github.com/google/riegeli/archive/master.zip"],
Expand Down Expand Up @@ -166,3 +177,19 @@ http_archive(

load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
protobuf_deps()

bind(
name = "python_headers",
actual = "@local_config_python//:python_headers",
)

load("@com_google_riegeli//python/riegeli:python_configure.bzl", "python_configure")

bind(
name = "six",
actual = "@six_archive//:six",
)

python_configure(name = "local_config_python")

register_toolchains("@local_config_python//:toolchain")
27 changes: 27 additions & 0 deletions agent_based_epidemic_sim/applications/risk_learning/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Libraries for contact tracing simulation.

load("@com_google_protobuf//:protobuf.bzl", "py_proto_library")

package(default_visibility = [
"//agent_based_epidemic_sim:internal",
])
Expand Down Expand Up @@ -27,6 +43,17 @@ proto_library(
],
)

py_proto_library(
name = "exposures_per_test_result_py_pb2",
srcs = [
"exposures_per_test_result.proto",
],
deps = [
"//agent_based_epidemic_sim/core:pandemic_py_pb2",
"@com_google_protobuf//:protobuf_python",
],
)

cc_proto_library(
name = "config_cc_proto",
deps = [":config_proto"],
Expand Down
10 changes: 10 additions & 0 deletions agent_based_epidemic_sim/core/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("@com_google_protobuf//:protobuf.bzl", "py_proto_library")

licenses(["notice"])

package(default_visibility = [
Expand Down Expand Up @@ -733,6 +735,14 @@ proto_library(
],
)

py_proto_library(
name = "pandemic_py_pb2",
srcs = ["pandemic.proto"],
deps = [
"@com_google_protobuf//:protobuf_python",
],
)

proto_library(
name = "parameter_distribution_proto",
srcs = ["parameter_distribution.proto"],
Expand Down
24 changes: 24 additions & 0 deletions agent_based_epidemic_sim/learning/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,27 @@ py_test(
requirement("six"),
],
)

py_library(
name = "abesim_data_loader",
srcs = ["abesim_data_loader.py"],
srcs_version = "PY3",
deps = [
"//agent_based_epidemic_sim/applications/risk_learning:exposures_per_test_result_py_pb2",
"@com_google_riegeli//python/riegeli",
],
)

py_test(
name = "abesim_data_loader_test",
srcs = ["abesim_data_loader_test.py"],
data = [
"testdata/fake_data_size_30",
],
python_version = "PY3",
srcs_version = "PY3",
deps = [
":abesim_data_loader",
requirement("absl-py"),
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class AbesimDataLoaderTest(absltest.TestCase):

def test_abesim_data_loader(self):
data_path = os.path.join(
FLAGS.test_srcdir,
"./",
'agent_based_epidemic_sim/learning/testdata/fake_data_size_30'
)

Expand Down

0 comments on commit edd6e34

Please sign in to comment.