Utils
async_kernel.utils ¶
Functions:
-
do_not_debug_this_thread
–A context to mark the thread for debugpy to not debug.
-
get_execute_request_timeout
–Gets the execute_request_timeout for the current context.
-
get_execution_count
–Gets the execution count for the current context, defaults to the current kernel count.
-
get_job
–Get the job for the current context.
-
get_metadata
–Gets metadata for the current context.
-
get_parent
–Get the parent message for the current context.
-
get_tags
–Gets the tags for the current context.
-
mark_thread_pydev_do_not_trace
–Modifies the given thread's attributes to hide or unhide it from the debugger (e.g., debugpy).
-
setattr_nested
–Set a nested attribute of an object.
-
wait_thread_event
–Wait for the threading event using an anyio worker thread.
do_not_debug_this_thread ¶
do_not_debug_this_thread(name='')
A context to mark the thread for debugpy to not debug.
Source code in src/async_kernel/utils.py
49 50 51 52 53 54 55 56 57 58 |
|
get_execute_request_timeout ¶
Gets the execute_request_timeout for the current context.
Source code in src/async_kernel/utils.py
111 112 113 114 115 116 117 118 |
|
get_execution_count ¶
get_execution_count() -> int
Gets the execution count for the current context, defaults to the current kernel count.
Source code in src/async_kernel/utils.py
121 122 123 124 |
|
get_job ¶
Get the job for the current context.
Source code in src/async_kernel/utils.py
88 89 90 91 92 93 |
|
get_kernel ¶
get_kernel() -> Kernel
Get the current kernel.
Source code in src/async_kernel/utils.py
83 84 85 |
|
get_metadata ¶
Gets metadata for the current context.
Source code in src/async_kernel/utils.py
101 102 103 |
|
get_parent ¶
Get the parent message for the current context.
Source code in src/async_kernel/utils.py
96 97 98 |
|
get_tags ¶
Gets the tags for the current context.
Source code in src/async_kernel/utils.py
106 107 108 |
|
mark_thread_pydev_do_not_trace ¶
mark_thread_pydev_do_not_trace(thread: Thread, name='', *, remove=False)
Modifies the given thread's attributes to hide or unhide it from the debugger (e.g., debugpy).
Source code in src/async_kernel/utils.py
42 43 44 45 46 |
|
setattr_nested ¶
Set a nested attribute of an object.
If the attribute name contains dots, it is interpreted as a nested attribute. For example, if name is "a.b.c", then the code will attempt to set obj.a.b.c to value.
This is primarily intended for use with async_kernel.command.command_line to set the nesteded attributes on on kernels.
Parameters:
-
obj
¶object
) –The object to set the attribute on.
-
name
¶str
) –The name of the attribute to set.
-
value
¶str | Any
) –The value to set the attribute to.
Returns:
-
dict[str, Any]
–The mapping of the name to the set value if the value has been set.
-
dict[str, Any]
–An empty dict indicates the value was not set.
Source code in src/async_kernel/utils.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
|
wait_thread_event
async
¶
wait_thread_event(event: Event)
Wait for the threading event using an anyio worker thread.
- If the event is already set anyio.sleep(0) is used instead.
- On external cancellation the event will be set enable the thread to exit.
Source code in src/async_kernel/utils.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
|