Skip to content

flex_rf.web.real_cost

Type: function Base(s): None

Get the billed cost for given task after it has been run.

The billed cost may not be immediately available when the task status is set to success, but should be available shortly after.

To obtain the cost of a simulation, you can use the function tidy3d.web.real_cost(task_id). In the example below, a job is created, and its cost is estimated. After running the simulation, the real cost can be obtained.

import time
# initializes job, puts task on server (but doesn't run it)
job = web.Job(simulation=sim, task_name="job", verbose=verbose)
# estimate the maximum cost
estimated_cost = web.estimate_cost(job.task_id)
print(f'The estimated maximum cost is {estimated_cost:.3f} Flex Credits.')
# Runs the simulation.
sim_data = job.run(path="data/sim_data.hdf5")
time.sleep(5)
# Get the billed FlexCredit cost after a simulation run.
cost = web.real_cost(job.task_id)
task_id [str]
verbose [bool] = True