Class Composition
Extends
CompositionItem.
Constructor Attributes | Constructor Name and Description |
---|---|
Represents the Composition itself.
|
Field Attributes | Field Name and Description |
---|---|
{boolean} |
True if the Composition is currently trying to abort due to a "force
stop" request.
|
{boolean} |
True if the Composition is currently trying to end early (before normal
completion) for any reason, such as a stop request or a fatal error.
|
{boolean} |
True if the Composition is being played in Preview mode.
|
{integer} |
If the Composition is repeating, this is the iteration number of the current
repeat of the Composition.
|
{integer} |
Always 0 for Compositions.
|
{integer} |
Always 0 for Compositions.
|
{integer} |
Always 0 for Compositions.
|
{integer} |
Always -1 for Compositions.
|
{String} |
The value "Composition".
|
- Fields borrowed from class CompositionItem:
- children, completionType, failureText, forEachValue, hasErrorEvents, index, name, nextItem, parent, path, previousItem, propertyList, REPEAT_DISTRIBUTION_CONSTANT, REPEAT_TIMING_PARALLEL, REPEAT_TIMING_SERIAL, REPEAT_TYPE_COUNT_CONSTANT, systemPropertyList
Method Attributes | Method Name and Description |
---|---|
abort(message, details)
Terminates the Composition as if there were an error.
|
|
pause()
Pauses the Composition, as if the user had pressed the "pause" button.
|
|
{object} |
rampAdjust(maxWaitTime, adjustments)
Adjusts all or a portion of the Composition's current "ramp" state.
|
Pauses the Composition's "ramp", if any, as if the user had pressed
the "pause ramp" button.
|
|
Resumes the Composition's "ramp", if any, as if the user had pressed
the "resume ramp" button.
|
|
stop()
Stops the Composition, as if the user had pressed the "stop" button.
|
- Methods borrowed from class CompositionItem:
- clearRepeat, end, endRepeat, getChild, getItemViaPath, setRepeat
Can be checked periodically by a Script that is doing a time-consuming operation, allowing it to terminate that operation early if it desires to do so. See also Composition#isEnding.
Read only.
- Since:
- Build 6594
Can be checked periodically by a Script that is doing a time-consuming operation, allowing it to terminate that operation early if it desires to do so. See also Composition#isAborting.
Read only.
- Since:
- Build 6594
Read only.
Compositions can be set to repeat via the "Repeat play" option in the "Play with options" dialog in Central, or in the "Play Options" dialog in the Composition Editor.
Read only.
Read only.
Read only.
Read only.
Read only.
Example:
$context.composition.abort("Message text from script", "Details\nfrom\nscript");
- Parameters:
- {String} message
Message to be inserted into the Result.
- {String} details Optional, Default: null
Optional multi-line detail text for the message to be inserted into the Result.
"Ramp" is defined as Track parallel repeating with a "start interval" and/or "end interval". The use of parallel repeat renewal is required for ramp adjustments to work properly.
This method may be called at any time, including when the ramp is paused or pausing, or when it is already resuming.
This method institutes the new ramping request, but does not wait for the specified ramping goal to actually be reached, as that might occur much later.
Passed in to this method is an array of objects, one object for each adjustment to be made. If only a single adjustment is to be made, then optionally that single object may be passed in instead of an array.
Each object in the array is a "struct" -- an object with properties (fields) with certain names.
- "type" (String) -- the type of adjustment. Must be either "hold" or "rampto" (case insensitive).
- "trackName" (String) -- the name of a Track who's ramping is to be adjusted. For multi-server Compositions, copies of Tracks are sometimes made on multiple servers. In that case, the name provided here must be the original name of the Track as it appears in the Composition, not the name of the individual copy on the server.
- "distributionName" (String) -- the name of the distribution within the Track that is to be adjusted.
- "userCount" (Number) -- Used only for adjustment type "rampto". The number of virtual users to ramp to. May be more (ramp up) or less (ramp down) than the current number of virtual users. This number is the total for all copies of this Track on all servers -- the count will be automatically distributed as evenly as possible across all servers on which copies of the Track reside.
- "time" (Number) -- Used only for adjustment type "rampto". The amount of time, in milliseconds, over which the ramp up or down is to take place. Must be greater than or equal to zero.
Note that, especially with ramp down, the ramp may not proceed exactly as requested, as playing Clips are not aborted or interrupted in the middle. The system must wait for individual Track instances to naturally come to an end.
In the case of "hold", each server will hold at the current number of virtual users at the time at which the request reaches that server, which may be some time later than when the Script executes, depending upon the number of servers in the Composition, network communication time, etc.
Adjustments for any Tracks may be made from any Script, even if the Script is not running on the server on which the Tracks to be adjusted reside. A Script can adjust the ramping for any Track, not just the Track in which the Script itself resides.
For multi-server Compositions, the request may take some time before it is accepted by all of the servers involved in the Composition, depending upon the number of servers, network communication time and errors, and so forth. The caller may choose whether or not to wait for the request to reach, and be accepted by, all servers. If it is chosen not to wait, then it is not possible for the Script to check back later in order to find out the eventual disposition of the request.
The return value is a "struct" -- an object with properties (fields) with certain names.
- "requestStatus" (String) -- An indicator as to whether the request has been completely accepted or not. Will be either "Pending" or "Completed".
- "requestNumber" (Number) -- An integer number is assigned to every ramp adjustment request, whther made by the user or from a Script. This number appears in events and error messages in the Result for identification purposes.
- "resultText" (String) -- If the request has completed, this contains multi-line text and messages describing what happened. This field will be empty if the request is still "pending".
Here is an example Script that changes Distribution 1 of Track 1 to ramp to 400 users over 5 minutes and Distribution 1 of Track 2 to to hold at its current level. It waits until the adjustments are accepted and then outputs information about the request to the Result.
var adjustments = new Array(); var adjustment = new Object(); adjustment.type = "rampto"; adjustment.trackName = "Track 1"; adjustment.distributionName = "Distribution 1"; adjustment.userCount = 400; adjustment.time = 300000; // 300 seconds = 5 minutes adjustments[0] = adjustment; adjustment = new Object(); adjustment.type = "hold"; adjustment.trackName = "Track 2"; adjustment.distributionName = "Distribution 1"; adjustments[1] = adjustment; var out = $context.composition.rampAdjust(null, adjustments); var details = "requestStatus=" + out.requestStatus + "\n"; details += "requestNumber=" + out.requestNumber + "\n"; details += "resultText=" + out.resultText + "\n"; $context.result.postMessage($context.result.LEVEL_INFO, "Disposition of ramp request", details);
- Parameters:
- {number} maxWaitTime
The maximum amount of time to wait for the request to complete, in milliseconds. A null or negative value specifies that the call will not return until the adjustments have been accepted.
- {object[]} adjustments
An array of objects that represent the ramp adjustments to be made (see above).
- Since:
- Build 6165
- Returns:
- {object}
An object that contains properties (fields) that indicate the status of the request (see above).
This merely starts the ramp pausing. The ramp will not actually be completely paused until all portions of the Composition on all servers have paused the ramp.
This method may be called at any time, including when the ramp is already paused or pausing, or when it is resuming.
"Ramp" is defined as Track parallel repeating with a "start interval" and/or "end interval".
This merely starts the ramp resuming. The ramp will not actually be completely resumed until all portions of the Composition on all servers have resumed the ramp.
This method may be called at any time, including when the ramp is not paused or pausing, or when it is already resuming.
"Ramp" is defined as Track parallel repeating with a "start interval" and/or "end interval".