CancellationToken
Symbolica documentation for getting started, symbolic expressions, numerical evaluation, pattern matching, and APIs in Python and Rust.
CancellationToken
class CancellationTokenA thread-safe signal for cancelling a long diagram-generation job.
Pass one token as cancellation_token and call cancel from a controlling thread when a large topology search should stop early.
Examples
from symbolica.community import hepkit as hep
token = hep.CancellationToken()
token.is_cancelled
FalseAttributes
| Name | Description |
|---|---|
is_cancelled |
Report whether cancellation has been requested. |
is_cancelled
CancellationToken.is_cancelled: builtins.boolReport whether cancellation has been requested.
Examples
Using the setup in the CancellationToken class example:
token = hep.CancellationToken()
token.cancel()
token.is_cancelled
TrueMethods
| Name | Description |
|---|---|
__new__ |
Create an independent token that can cancel a generation request. |
cancel |
Mark this token as cancelled for all generation requests using it. |
__new__
CancellationToken.__new__() -> CancellationTokenCreate an independent token that can cancel a generation request.
Examples
Using the setup in the CancellationToken class example:
token = hep.CancellationToken()cancel
CancellationToken.cancel() -> NoneMark this token as cancelled for all generation requests using it.
Examples
Using the setup in the CancellationToken class example:
token.cancel()