Project#loadProfile#
Reads per-bucket load and capacity of resources on the solved baseline of a Project. Needs a solved project: after apply, call solve(null) or level first. To get the load of hypothetical dates, use preview with its profile option instead.
Signature#
options: LoadProfileOptions: LoadProfile
Synchronous. Never changes the project.
Parameters#
| Name | Type | Description |
|---|---|---|
options |
LoadProfileOptions |
Required. Range, resources, bucket size, task lists and an optional baseline check. |
LoadProfileOptions#
What the profile covers, plus an optional expected baseline.
| Field | Type | Default | Description |
|---|---|---|---|
from |
DateValue |
required | Start of the range, inclusive. The profile holds every bucket whose start lies in [from, to). |
to |
DateValue |
required | End of the range, exclusive. Must be later than from; the range can hold at most 100 000 buckets per resource. |
resources |
Id[] |
every resource | Resources to include, in the order the profile lists them. Each id must name an existing resource. |
basis |
"hour" | "day" |
derived from config.duration_unit |
Bucket size. The profile reports the basis it used in basis. |
tasks |
"none" | "overallocated" | "all" |
"none" |
Which buckets list their booked task ids in tasks: none, only buckets where load exceeds capacity, or all. |
baselineId |
string |
none | Expected baseline token, taken from the latest result's baselineId. A mismatch throws ProjectError("stale-baseline"). Absent skips the check. |
Note
Pass the query fields (from, to, ...) directly in the options object, next to baselineId.
Returns#
A LoadProfile: a fresh object that shares nothing with the project. Bucket start dates are strings, or local Date objects on a project created with dates: "date".
Errors#
| Error | When |
|---|---|
ProjectError "no-baseline" |
The project is unsolved, including after apply |
ProjectError "stale-baseline" |
options.baselineId doesn't name the current baseline |
InputError "validation" |
to <= from, or more than 100 000 buckets per resource (path "to"); an unknown resource id (path "resources"); a tasks value other than the three listed |
InputError "parse" |
options is missing, lacks from or to, or has an unknown key |
Error("Project has been disposed") |
The project was disposed |
Example#
Print the overloaded days of a resource that works on two tasks at once.
const = new;
const = ;
const = ;
// dev at 2026-01-02 00:00: 2 of 1 (a, b)
Related#
Project- the class and its other methodsLoadProfile- the returned profileProfileQuery- the same query inpreviewoptions- Resource Load - querying profiles for histograms