MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / main

Function main

misc/python/materialize/benches/avro_ingest.py:71–171  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

69
70
71def main() -> None:
72 parser = argparse.ArgumentParser()
73 parser.add_argument(
74 "--confluent-host",
75 default="confluent",
76 help="The hostname of a machine running the Confluent Platform",
77 )
78 parser.add_argument(
79 "-n",
80 "--trials",
81 default=1,
82 type=int,
83 help="Number of measurements to take",
84 )
85 parser.add_argument(
86 "-r",
87 "--records",
88 default=1000000,
89 type=int,
90 help="Number of Avro records to generate",
91 )
92 args = parser.parse_args()
93
94 os.chdir(MZ_ROOT)
95 coverage = ui.env_is_truthy("CI_COVERAGE_ENABLED")
96
97 repo = mzbuild.Repository(
98 MZ_ROOT,
99 coverage=coverage,
100 )
101
102 wait_for_confluent(args.confluent_host)
103
104 images = ["kgen", "materialized"]
105 deps = repo.resolve_dependencies([repo.images[name] for name in images])
106 deps.acquire()
107
108 docker_client = docker.from_env()
109
110 # NOTE: We have to override the type below because if `detach=True` it
111 # returns a Container, and the typechecker doesn't know that.
112 mz_container: Container = cast(
113 Container,
114 docker_client.containers.run(
115 deps["materialized"].spec(),
116 detach=True,
117 network_mode="host",
118 ),
119 )
120
121 docker_client.containers.run(
122 deps["kgen"].spec(),
123 [
124 f"--num-records={args.records}",
125 f"--bootstrap-server={args.confluent_host}:9092",
126 f"--schema-registry-url=http://{args.confluent_host}:8081",
127 "--topic=bench_data",
128 "--keys=avro",

Callers 1

avro_ingest.pyFile · 0.70

Calls 12

resolve_dependenciesMethod · 0.95
wait_for_confluentFunction · 0.85
PrevStatsClass · 0.85
acquireMethod · 0.80
specMethod · 0.80
cursorMethod · 0.80
print_statsFunction · 0.70
runMethod · 0.45
connectMethod · 0.45
executeMethod · 0.45
encodeMethod · 0.45
sleepMethod · 0.45

Tested by

no test coverage detected