tidy3d.web.api.webapi.real_cost#
- class real_cost[source]#
Bases:
Get the billed cost for given task after it has been run.
- Parameters:
task_id (str) β Unique identifier of task on server. Returned by
upload()
.verbose (bool = True) β Whether to log the cost and helpful messages.
- Returns:
The flex credit cost that was billed for the given
task_id
.- Return type:
float
Note
The billed cost may not be immediately available when the task status is set to
success
, but should be available shortly after.Examples
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)
Inherited Common Usage