Ready for first real test
This commit is contained in:
1 parent
acddf9135f
commit
b91c81ebdf
46 files changed
+34903
-26
No files matched your search
@@ -31,6 +31,7 @@ from orchestration.budget import ( # noqa: E402
|
||||
next_market_trade_date,
|
||||
)
|
||||
from orchestration.checkpoint import Checkpointer # noqa: E402
|
||||
from reporting import report_writer # noqa: E402
|
||||
|
||||
|
||||
def main(compressed: bool = False) -> int:
|
||||
@@ -45,6 +46,15 @@ def main(compressed: bool = False) -> int:
|
||||
logger.error("oMLX not ready; aborting.")
|
||||
return 1
|
||||
|
||||
# preflight: confirm internet before committing to a long run (warn but continue)
|
||||
try:
|
||||
from tools.web import web_search
|
||||
|
||||
probe = web_search.invoke({"query": "stock market news today"})
|
||||
logger.info("internet preflight: {}", "OK" if "http" in probe else "no results (degraded)")
|
||||
except Exception as e:
|
||||
logger.warning("internet preflight failed (continuing): {}", e)
|
||||
|
||||
model_name = resolve_model_id()
|
||||
run_id = datetime.now(timezone.utc).strftime("%Y%m%dT%H%M%SZ")
|
||||
cp = Checkpointer(s.output_dir, trade_date)
|
||||
@@ -61,7 +71,9 @@ def main(compressed: bool = False) -> int:
|
||||
per_agent_cap_s = 5 * 60 if compressed else s.per_agent_wallclock_min * 60
|
||||
step_budget = 12 if compressed else s.per_agent_step_budget
|
||||
min_steps = 4 if compressed else s.per_agent_min_steps
|
||||
min_seconds = 60 if compressed else s.per_agent_min_minutes * 60
|
||||
|
||||
outputs = []
|
||||
for i, persona in enumerate(PERSONAS):
|
||||
now = time.time()
|
||||
if now >= hard_stop:
|
||||
@@ -71,9 +83,22 @@ def main(compressed: bool = False) -> int:
|
||||
logger.info("--- {} until {} ---", persona.id,
|
||||
datetime.fromtimestamp(deadline).strftime("%H:%M:%S"))
|
||||
out = run_agent(persona, deadline_ts=deadline, step_budget=step_budget,
|
||||
min_steps=min_steps, checkpointer=cp, model_name=model_name)
|
||||
min_steps=min_steps, min_seconds=min_seconds,
|
||||
checkpointer=cp, model_name=model_name)
|
||||
cp.write(out)
|
||||
outputs.append(out)
|
||||
manifest.agents.append(persona.id)
|
||||
try:
|
||||
report_writer.write_agent_report(out, trade_date) # analyst research note
|
||||
except Exception as e:
|
||||
logger.warning("agent report failed for {}: {}", persona.id, e)
|
||||
|
||||
# combined daily report (execution results appended in the morning by run_market_open)
|
||||
try:
|
||||
daily = report_writer.write_daily_report(trade_date, outputs)
|
||||
report_writer.to_pdf(daily)
|
||||
except Exception as e:
|
||||
logger.warning("daily report failed: {}", e)
|
||||
|
||||
manifest.status = "complete"
|
||||
manifest.ended_at = datetime.now(timezone.utc)
|
||||
|
||||
Reference in new issue
Block a user