Skip to content

Commit

Permalink
Update runner.py
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxHalford committed Oct 4, 2024
1 parent c56c282 commit 4139784
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lea/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ def status(self):
def error(self) -> BaseException | None:
return self.future.exception()

@property
def cost(self) -> float | None:
if result := self.future.result():
return result.cost


class Runner:
def __init__(self, views_dir: pathlib.Path | str, client: lea.clients.Client, verbose=False):
Expand Down Expand Up @@ -389,7 +394,10 @@ def run(
if job.status == SUCCESS:
duration = job.finished_at - job.started_at
duration_str = f"{int(round(duration.total_seconds()))}s"
console.log(f"{SUCCESS} {job.view} in {duration_str}")
msg = f"{SUCCESS} {job.view} in {duration_str}"
if job.cost:
msg += f" for ${job.cost:,.5f}"
console.log(msg)

# Save the cache
all_jobs_succeeded = all(job.status == SUCCESS for job in jobs.values())
Expand Down

0 comments on commit 4139784

Please sign in to comment.