49 lines
1.7 KiB
Python
49 lines
1.7 KiB
Python
"""Pilot: generate and validate a list of tasks, one after the other."""
|
|
import json
|
|
import os
|
|
import sys
|
|
|
|
from .adt_client import load_env
|
|
from .generator import ROOT, generate
|
|
from .ledger import BudgetExceeded, spent
|
|
|
|
PLAN = [
|
|
("CLAS", "A"), ("CLAS", "B"), ("CLAS", "C"), ("CLAS", "D"), ("CLAS", "E"),
|
|
("CLAS", "F"), ("CLAS", "G"), ("CLAS", "I"), ("CLAS", "C"),
|
|
("FUNC", "A"), ("FUNC", "F"), ("FUNC", "I"),
|
|
("PROG", "B"), ("PROG", "B"), ("PROG", "E"),
|
|
("DDLS", "B"), ("DDLS", "B"), ("DDLS", "B"), ("DDLS", "B"), ("DDLS", "B"),
|
|
]
|
|
DDLS_TOPICS = ["join of two tables and a calculated element", "association and path expression",
|
|
"aggregation with CASE and GROUP BY", "view with input parameters",
|
|
"UNION of two tables with a literal source element"]
|
|
|
|
|
|
def main():
|
|
load_env(os.path.join(ROOT, ".env"))
|
|
first = int(sys.argv[1]) if len(sys.argv) > 1 else 2
|
|
results = []
|
|
d = 0
|
|
for k, (otype, cat) in enumerate(PLAN):
|
|
tid = f"G{first + k:04d}"
|
|
topic = None
|
|
if otype == "DDLS":
|
|
topic, d = DDLS_TOPICS[d], d + 1
|
|
try:
|
|
log = generate(tid, "eval", otype, cat, 2, "deepseek-v4.1-flash:cloud",
|
|
os.environ.get("LLM_BASE_URL", "http://127.0.0.1:11434/v1"),
|
|
1100 + 10 * k, topic)
|
|
except BudgetExceeded as e:
|
|
print("BUDGET", e, flush=True)
|
|
break
|
|
except Exception as e: # noqa: BLE001
|
|
log = {"id": tid, "error": str(e)[:500]}
|
|
log["spent_total"] = spent()
|
|
results.append(log)
|
|
print(json.dumps(log), flush=True)
|
|
json.dump(results, open(os.path.join(ROOT, "runs", "gen", "pilot.json"), "w"), indent=1)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|