MCPcopy
hub / github.com/dlt-hub/dlt / assert_load_info

Function assert_load_info

tests/pipeline/utils.py:159–179  ·  view source on GitHub ↗

Assert that all load packages completed successfully. Args: info (LoadInfo): The load information instance returned by DLT after executing ``pipeline.run()`` or ``pipeline.load()``. expected_load_packages (int, optional): How many load packages should be

(info: LoadInfo, expected_load_packages: int = 1)

Source from the content-addressed store, hash-verified

157
158
159def assert_load_info(info: LoadInfo, expected_load_packages: int = 1) -> None:
160 """Assert that all load packages completed successfully.
161
162 Args:
163 info (LoadInfo): The load information instance returned by DLT after
164 executing ``pipeline.run()`` or ``pipeline.load()``.
165 expected_load_packages (int, optional): How many load packages should be
166 present in *info*. Defaults to 1.
167
168 Raises:
169 AssertionError: If the amount of load packages or any job status does
170 not match the expectations.
171 """
172 # make sure we can serialize
173 info.asstr(verbosity=2)
174 info.asdict()
175 assert len(info.loads_ids) == expected_load_packages
176 # all packages loaded
177 assert all(p.completed_at is not None for p in info.load_packages) is True
178 # no failed jobs in any of the packages
179 assert all(len(p.jobs["failed_jobs"]) == 0 for p in info.load_packages) is True
180
181
182#

Calls 2

asstrMethod · 0.45
asdictMethod · 0.45