Scheduler¶
Calls¶
cancel¶
Cancel an anonymously scheduled task.
Attributes¶
Name | Type |
---|---|
when | BlockNumberFor<T> |
index | u32 |
Python¶
call = substrate.compose_call(
'Scheduler', 'cancel', {'index': 'u32', 'when': 'u32'}
)
cancel_named¶
Cancel a named scheduled task.
Attributes¶
Name | Type |
---|---|
id | TaskName |
Python¶
call = substrate.compose_call(
'Scheduler', 'cancel_named', {'id': '[u8; 32]'}
)
cancel_retry¶
Removes the retry configuration of a task.
Attributes¶
Name | Type |
---|---|
task | TaskAddress<BlockNumberFor<T>> |
Python¶
call = substrate.compose_call(
'Scheduler', 'cancel_retry', {'task': ('u32', 'u32')}
)
cancel_retry_named¶
Cancel the retry configuration of a named task.
Attributes¶
Name | Type |
---|---|
id | TaskName |
Python¶
call = substrate.compose_call(
'Scheduler', 'cancel_retry_named', {'id': '[u8; 32]'}
)
schedule¶
Anonymously schedule a task.
Attributes¶
Name | Type |
---|---|
when | BlockNumberFor<T> |
maybe_periodic | Option<schedule::Period<BlockNumberFor<T>>> |
priority | schedule::Priority |
call | Box<<T as Config>::RuntimeCall> |
Python¶
call = substrate.compose_call(
'Scheduler', 'schedule', {
'call': 'Call',
'maybe_periodic': (
None,
('u32', 'u32'),
),
'priority': 'u8',
'when': 'u32',
}
)
schedule_after¶
Anonymously schedule a task after a delay.
Attributes¶
Name | Type |
---|---|
after | BlockNumberFor<T> |
maybe_periodic | Option<schedule::Period<BlockNumberFor<T>>> |
priority | schedule::Priority |
call | Box<<T as Config>::RuntimeCall> |
Python¶
call = substrate.compose_call(
'Scheduler', 'schedule_after', {
'after': 'u32',
'call': 'Call',
'maybe_periodic': (
None,
('u32', 'u32'),
),
'priority': 'u8',
}
)
schedule_named¶
Schedule a named task.
Attributes¶
Name | Type |
---|---|
id | TaskName |
when | BlockNumberFor<T> |
maybe_periodic | Option<schedule::Period<BlockNumberFor<T>>> |
priority | schedule::Priority |
call | Box<<T as Config>::RuntimeCall> |
Python¶
call = substrate.compose_call(
'Scheduler', 'schedule_named', {
'call': 'Call',
'id': '[u8; 32]',
'maybe_periodic': (
None,
('u32', 'u32'),
),
'priority': 'u8',
'when': 'u32',
}
)
schedule_named_after¶
Schedule a named task after a delay.
Attributes¶
Name | Type |
---|---|
id | TaskName |
after | BlockNumberFor<T> |
maybe_periodic | Option<schedule::Period<BlockNumberFor<T>>> |
priority | schedule::Priority |
call | Box<<T as Config>::RuntimeCall> |
Python¶
call = substrate.compose_call(
'Scheduler', 'schedule_named_after', {
'after': 'u32',
'call': 'Call',
'id': '[u8; 32]',
'maybe_periodic': (
None,
('u32', 'u32'),
),
'priority': 'u8',
}
)
set_retry¶
Set a retry configuration for a task so that, in case its scheduled run fails, it will
be retried after period
blocks, for a total amount of retries
retries or until it
succeeds.
Tasks which need to be scheduled for a retry are still subject to weight metering and agenda space, same as a regular task. If a periodic task fails, it will be scheduled normally while the task is retrying.
Tasks scheduled as a result of a retry for a periodic task are unnamed, non-periodic
clones of the original task. Their retry configuration will be derived from the
original task's configuration, but will have a lower value for remaining
than the
original total_retries
.
Attributes¶
Name | Type |
---|---|
task | TaskAddress<BlockNumberFor<T>> |
retries | u8 |
period | BlockNumberFor<T> |
Python¶
call = substrate.compose_call(
'Scheduler', 'set_retry', {
'period': 'u32',
'retries': 'u8',
'task': ('u32', 'u32'),
}
)
set_retry_named¶
Set a retry configuration for a named task so that, in case its scheduled run fails, it
will be retried after period
blocks, for a total amount of retries
retries or until
it succeeds.
Tasks which need to be scheduled for a retry are still subject to weight metering and agenda space, same as a regular task. If a periodic task fails, it will be scheduled normally while the task is retrying.
Tasks scheduled as a result of a retry for a periodic task are unnamed, non-periodic
clones of the original task. Their retry configuration will be derived from the
original task's configuration, but will have a lower value for remaining
than the
original total_retries
.
Attributes¶
Name | Type |
---|---|
id | TaskName |
retries | u8 |
period | BlockNumberFor<T> |
Python¶
call = substrate.compose_call(
'Scheduler', 'set_retry_named', {
'id': '[u8; 32]',
'period': 'u32',
'retries': 'u8',
}
)
Events¶
CallUnavailable¶
The call for the provided hash was not found so the task has been aborted.
Attributes¶
Name | Type | Composition |
---|---|---|
task | TaskAddress<BlockNumberFor<T>> |
('u32', 'u32') |
id | Option<TaskName> |
(None, '[u8; 32]') |
Canceled¶
Canceled some task.
Attributes¶
Name | Type | Composition |
---|---|---|
when | BlockNumberFor<T> |
u32 |
index | u32 |
u32 |
Dispatched¶
Dispatched some task.
Attributes¶
Name | Type | Composition |
---|---|---|
task | TaskAddress<BlockNumberFor<T>> |
('u32', 'u32') |
id | Option<TaskName> |
(None, '[u8; 32]') |
result | DispatchResult |
{'Ok': (), 'Err': {'Other': None, 'CannotLookup': None, 'BadOrigin': None, 'Module': {'index': 'u8', 'error': '[u8; 4]'}, 'ConsumerRemaining': None, 'NoProviders': None, 'TooManyConsumers': None, 'Token': ('FundsUnavailable', 'OnlyProvider', 'BelowMinimum', 'CannotCreate', 'UnknownAsset', 'Frozen', 'Unsupported', 'CannotCreateHold', 'NotExpendable', 'Blocked'), 'Arithmetic': ('Underflow', 'Overflow', 'DivisionByZero'), 'Transactional': ('LimitReached', 'NoLayer'), 'Exhausted': None, 'Corruption': None, 'Unavailable': None, 'RootNotAllowed': None}} |
PeriodicFailed¶
The given task was unable to be renewed since the agenda is full at that block.
Attributes¶
Name | Type | Composition |
---|---|---|
task | TaskAddress<BlockNumberFor<T>> |
('u32', 'u32') |
id | Option<TaskName> |
(None, '[u8; 32]') |
PermanentlyOverweight¶
The given task can never be executed since it is overweight.
Attributes¶
Name | Type | Composition |
---|---|---|
task | TaskAddress<BlockNumberFor<T>> |
('u32', 'u32') |
id | Option<TaskName> |
(None, '[u8; 32]') |
RetryCancelled¶
Cancel a retry configuration for some task.
Attributes¶
Name | Type | Composition |
---|---|---|
task | TaskAddress<BlockNumberFor<T>> |
('u32', 'u32') |
id | Option<TaskName> |
(None, '[u8; 32]') |
RetryFailed¶
The given task was unable to be retried since the agenda is full at that block or there was not enough weight to reschedule it.
Attributes¶
Name | Type | Composition |
---|---|---|
task | TaskAddress<BlockNumberFor<T>> |
('u32', 'u32') |
id | Option<TaskName> |
(None, '[u8; 32]') |
RetrySet¶
Set a retry configuration for some task.
Attributes¶
Name | Type | Composition |
---|---|---|
task | TaskAddress<BlockNumberFor<T>> |
('u32', 'u32') |
id | Option<TaskName> |
(None, '[u8; 32]') |
period | BlockNumberFor<T> |
u32 |
retries | u8 |
u8 |
Scheduled¶
Scheduled some task.
Attributes¶
Name | Type | Composition |
---|---|---|
when | BlockNumberFor<T> |
u32 |
index | u32 |
u32 |
Storage functions¶
Agenda¶
Items to be executed, indexed by the block number that they should be executed on.
Python¶
result = substrate.query(
'Scheduler', 'Agenda', ['u32']
)
Return value¶
[
(
None,
{
'call': {
'Inline': 'Bytes',
'Legacy': 'InnerStruct',
'Lookup': 'InnerStruct',
},
'maybe_id': (None, '[u8; 32]'),
'maybe_periodic': (None, ('u32', 'u32')),
'origin': {
'Triumvirate': 'scale_info::158',
'Void': 'scale_info::106',
'system': 'scale_info::157',
None: None,
},
'priority': 'u8',
},
),
]
IncompleteSince¶
Python¶
result = substrate.query(
'Scheduler', 'IncompleteSince', []
)
Return value¶
'u32'
Lookup¶
Lookup from a name to the block number and index of the task.
For v3 -> v4 the previously unbounded identities are Blake2-256 hashed to form the v4 identities.
Python¶
result = substrate.query(
'Scheduler', 'Lookup', ['[u8; 32]']
)
Return value¶
('u32', 'u32')
Retries¶
Retry configurations for items to be executed, indexed by task address.
Python¶
result = substrate.query(
'Scheduler', 'Retries', [('u32', 'u32')]
)
Return value¶
{'period': 'u32', 'remaining': 'u8', 'total_retries': 'u8'}
Constants¶
MaxScheduledPerBlock¶
The maximum number of scheduled calls in the queue for a single block.
NOTE:
+ Dependent pallets' benchmarks might require a higher limit for the setting. Set a
higher limit under runtime-benchmarks
feature.
Value¶
50
Python¶
constant = substrate.get_constant('Scheduler', 'MaxScheduledPerBlock')
MaximumWeight¶
The maximum weight that may be scheduled per block for any dispatchables.
Value¶
{'proof_size': 14757395258967641292, 'ref_time': 3200000000000}
Python¶
constant = substrate.get_constant('Scheduler', 'MaximumWeight')
Errors¶
FailedToSchedule¶
Failed to schedule a call
Named¶
Attempt to use a non-named function on a named task.
NotFound¶
Cannot find the scheduled call.
RescheduleNoChange¶
Reschedule failed because it does not change scheduled time.
TargetBlockNumberInPast¶
Given target block number is in the past.