tidy3d.web.api.webapi.estimate_cost#
- class estimate_cost[source]#
Bases:
Compute the maximum FlexCredit charge for a given task.
- Parameters:
task_id (str) β Unique identifier of task on server. Returned by
upload()
.verbose (bool = True) β Whether to log the cost and helpful messages.
solver_version (str = None) β Target solver version.
- Returns:
Estimated maximum cost for
Simulation
associated with giventask_id
.- Return type:
float
Note
Cost is calculated assuming the simulation runs for the full
run_time
. If early shut-off is triggered, the cost is adjusted proportionately. A minimum simulation cost may also apply, which depends on the task details.Notes
We can get the cost estimate of running the task before actually running it. This prevents us from accidentally running large jobs that we set up by mistake. The estimated cost is the maximum cost corresponding to running all the time steps.
Examples
Basic example:
# 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.')
Inherited Common Usage