For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).
Mojo function
get_safe_task_id
def get_safe_task_id(ctx: DeviceContext) -> OptionalReg[Int]
Returns the task ID for the device behind a DeviceContext.
Args:
- ctx (
DeviceContext): The device context to extract the task ID from.
Returns:
OptionalReg[Int]: An OptionalReg containing the device's ID.
def get_safe_task_id(ctx: Optional[DeviceContext[target]]) -> OptionalReg[Int]
Safely extract task_id from an optional DeviceContext, returning None if the context is absent or invalid.
Args:
- ctx (
Optional[DeviceContext[target]]): The optional device context to extract the task ID from.
Returns:
OptionalReg[Int]: An OptionalReg containing the task ID if ctx is set and the
underlying handle is valid, None otherwise.