Coverage for /usr/local/lib/python3.12/site-packages/prefect/_experimental/bundles/execute.py: 33%
14 statements
« prev ^ index » next coverage.py v7.10.6, created at 2025-12-05 10:48 +0000
« prev ^ index » next coverage.py v7.10.6, created at 2025-12-05 10:48 +0000
1import json 1a
2import sys 1a
4from prefect.utilities.asyncutils import run_coro_as_sync 1a
7def execute_bundle_from_file(key: str): 1a
8 """
9 Loads a bundle from a file and executes it.
11 Args:
12 key: The key of the bundle to execute.
13 """
14 with open(key, "r") as f:
15 bundle = json.load(f)
17 from prefect.runner.runner import Runner
19 run_coro_as_sync(Runner().execute_bundle(bundle))
22if __name__ == "__main__": 22 ↛ 23line 22 didn't jump to line 23 because the condition on line 22 was never true1a
23 if len(sys.argv) < 3 and sys.argv[1] != "--key":
24 print("Please provide a key representing a path to a bundle")
25 sys.exit(1)
26 key = sys.argv[2]
27 execute_bundle_from_file(key)