Small updates to podcast reviews example

This commit is contained in:
Stuart Axelbrooke 2025-07-26 22:47:39 -07:00
parent 0810c82e7d
commit 339e295abc
3 changed files with 9 additions and 53 deletions

View file

@ -184,12 +184,6 @@ databuild_job(
binary = ":test_job_binary", binary = ":test_job_binary",
) )
py_binary(
name = "test_job_binary",
srcs = ["unified_job.py"],
main = "unified_job.py",
)
# Test target # Test target
py_binary( py_binary(
name = "test_jobs", name = "test_jobs",

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View file

@ -1,47 +0,0 @@
#!/usr/bin/env python3
import sys
import json
def main():
if len(sys.argv) < 2:
print("Usage: unified_job.py {config|exec} [args...]", file=sys.stderr)
sys.exit(1)
command = sys.argv[1]
if command == "config":
handle_config(sys.argv[2:])
elif command == "exec":
handle_exec(sys.argv[2:])
else:
print(f"Unknown command: {command}", file=sys.stderr)
print("Usage: unified_job.py {config|exec} [args...]", file=sys.stderr)
sys.exit(1)
def handle_config(args):
if len(args) < 1:
print("Config mode requires partition ref", file=sys.stderr)
sys.exit(1)
partition_ref = args[0]
config = {
"configs": [{
"outputs": [{"str": partition_ref}],
"inputs": [],
"args": ["Hello", "gorgeous", partition_ref],
"env": {"PARTITION_REF": partition_ref}
}]
}
print(json.dumps(config))
def handle_exec(args):
print("What a time to be alive.")
print(f"Partition ref: {os.getenv('PARTITION_REF', 'unknown')}")
print(f"Args: {args}")
if __name__ == "__main__":
import os
main()