Skip to content

flex_rf.web.estimate_cost

Type: function Base(s): None

Compute the maximum FlexCredit charge for a given task.

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.

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.

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.')
task_id [str]
verbose [bool] = True
solver_version [str | None] = None