Skip to content

OnDemandAssignmentProvider


Calls


place_order_allow_death

See [Pallet::place_order_allow_death].

Attributes

Name Type
max_amount BalanceOf<T>
para_id ParaId

Python

call = substrate.compose_call(
    'OnDemandAssignmentProvider', 'place_order_allow_death', {
    'max_amount': 'u128',
    'para_id': 'u32',
}
)

place_order_keep_alive

See [Pallet::place_order_keep_alive].

Attributes

Name Type
max_amount BalanceOf<T>
para_id ParaId

Python

call = substrate.compose_call(
    'OnDemandAssignmentProvider', 'place_order_keep_alive', {
    'max_amount': 'u128',
    'para_id': 'u32',
}
)

Events


OnDemandOrderPlaced

An order was placed at some spot price amount.

Attributes

Name Type Composition
para_id ParaId u32
spot_price BalanceOf<T> u128

SpotTrafficSet

The value of the spot traffic multiplier changed.

Attributes

Name Type Composition
traffic FixedU128 u128

Storage functions


OnDemandQueue

The order storage entry. Uses a VecDeque to be able to push to the front of the queue from the scheduler on session boundaries.

Python

result = substrate.query(
    'OnDemandAssignmentProvider', 'OnDemandQueue', []
)

Return value

[{'para_id': 'u32'}]

ParaIdAffinity

Maps a ParaId to CoreIndex and keeps track of how many assignments the scheduler has in it's lookahead. Keeping track of this affinity prevents parallel execution of the same ParaId on two or more CoreIndexes.

Python

result = substrate.query(
    'OnDemandAssignmentProvider', 'ParaIdAffinity', ['u32']
)

Return value

{'core_idx': 'u32', 'count': 'u32'}

SpotTraffic

Keeps track of the multiplier used to calculate the current spot price for the on demand assigner.

Python

result = substrate.query(
    'OnDemandAssignmentProvider', 'SpotTraffic', []
)

Return value

'u128'

Constants


TrafficDefaultValue

The default value for the spot traffic multiplier.

Value

1000000000000000000

Python

constant = substrate.get_constant('OnDemandAssignmentProvider', 'TrafficDefaultValue')

Errors


InvalidParaId

The ParaId supplied to the place_order call is not a valid ParaThread, making the call is invalid.


QueueFull

The order queue is full, place_order will not continue.


SpotPriceHigherThanMaxAmount

The current spot price is higher than the max amount specified in the place_order call, making it invalid.