System abstractions and processors for managing a processing tree.
os
sys0
functools0
collections0
contextlib0
weakref0
traceback0
itertools0
signal0
operator0
heapq0
sleep0
tools0
weak0
kernel0
network0
io0
process0
thread0
memory0
execution0
time0
core0
flows0
text0
__process_index__0
__process_index__ = dict()
Matrix0
Collection of fault.system.io.Array instances connecting transfers to KChannel instances.
MatrixArray0
Matrixchannels_per_array0
channels_per_array = 1024 * 16
MatrixDelta0
Transfer events snapshot delivered to I/O tasks.
MatrixDelta__slots__0
__slots__ = ()
MatrixDelta__str__0
__str__(self)
MatrixDelta__repr__0
__repr__(self)
MatrixDeltapayload0
Units sent.
MatrixDeltademand0
The acquire method of the channel if exhausted. None if not exhausted.
MatrixDeltaterminal0
Whether or not this is the last event from the Channel.
MatrixDeltaendpoint0
MatrixDeltaconstruct0
construct(Class)
MatrixDeltasnapshot0
snapshot(Class, channel)
Matrixio_collect653%
io_collect(transfers)
Process the array's transfer and construct a sequence of I/O events.
This is executed inside a thread managed by the matrix and cannot deliver the events to Transformers. synchronize_io_events is used to deliver the queue for processing in the main task queue.
Matrixio_deliver1534%
io_deliver(error, events)
Send the individual events originally prepared by io_collect to their associated KInput or KOutput flows.
Matrixio_delta40%
io_delta(array)
Inline I/O handler for schduler based transfers.
Matrixio_loop292%
io_loop()
Matrix__init__0
__init__(self, errors, synchronize, execute)
Matrix_alloc0
_alloc(self)
Matrix_get0
_get(self)
Matrixvoid175%
void(self)
Violently destroy all channels and Arrays in the Matrix.
All arrays allocated by the Matrix will be terminated.
| WARNING | |
This method should only be ran after forking and inside the child process. |
Matrixforce0
force(self)
Execute the Array.force method on the set designated of Array instances designated by id.
Matrixterminate0
terminate(self)
Terminate all arrays managed by the matrix.
Matrixacquire0
acquire(self, channels)
Acquire a set of channels accounting for volume limits.
KChannel0
Channel moving data in or out of the operating system's kernel.
KChannelk_status
k_status = None
KChannel__init__0
__init__(self)
KChannelactuate0
actuate(self)
KChannelk_meta30%
k_meta(self)
KChannel__repr__110%
__repr__(self)
KChannelstructure110%
structure(self)
KChannelk_transition10%
k_transition(self)
KChannelk_kill50%
k_kill(self)
Called by the controlling Flow, acquire status information and unlink the channel.
KChannelinterrupt30%
interrupt(self)
KChannelf_terminated30%
f_terminated(self)
KChannelf_transfer10%
f_transfer(self, event)
KChannelk_transferring0
The length of the buffer being transferred into or out of the kernel.
None if no transfer is currently taking place.
KAllocate0
Flow that continually allocates memory for a channel transferring data into the process.
KAllocatef_clear20%
f_clear(self, obstruction)
KAllocatek_transition0
k_transition(self)
Transition in the next buffer provided that the Flow was not obstructed.
KAllocatef_transfer30%
f_transfer(self, event)
Normally ignored, but will induce a transition if no transfer is occurring.
KAccept0
Manage the event connection to a listening socket and process read events by accepting and transmitting the socket file descriptors.
KAcceptAllocate0
Allocate = kernel.Ports.allocate
KAccept__init__30%
__init__(self, kport)
KAcceptactuate10%
actuate(self)
KAcceptf_transfer30%
f_transfer(self, event)
KAcceptinterrupt30%
interrupt(self)
KAcceptf_terminate20%
f_terminate(self)
KInput0
Receive octets from the system I/O channel.
KLimit0
Receive octets from the system I/O channel with limited memory allocations. Primarily used to read portions of a file.
KLimitk_limit
k_limit = None
KLimitk_set_limit80%
k_set_limit(self, limit)
KLimitk_transition50%
k_transition(self)
Transition in the next buffer provided that the Flow was not obstructed.
KOutput0
Flow that transfers emitted events to be transferred into the kernel.
The queue is limited to a certain number of items rather than a metadata constraint; for instance, the sum of the length of the buffer entries. This allows the connected Flows to dynamically choose the buffer size by adjusting the size of the events.
KOutputko_limit
ko_limit = 16
@property
KOutputko_overflow20%
Queue entries exceeds limit.
KOutputf_empty40%
KOutput__init__0
__init__(self, channel)
KOutputk_transition442%
k_transition(self)
KOutputf_transfer266%
f_transfer(self, event)
Enqueue a sequence of transfers to be processed by the Transit.
KOutputf_terminate50%
f_terminate(self)
Context0
System Transaction Context implementation providing Abstract Processors with access to the local system.
Contextxact_exit90%
xact_exit(self, xact)
Contextxact_void40%
xact_void(self, final)
Final (executable) transaction exited; system process context complete.
Contextinterrupt30%
interrupt(self)
Contextsigterm20%
sigterm(self, link)
Contextterminate30%
terminate(self)
Contextprocess0
Contextkdispatch30%
kdispatch(self, event, task)
Contextkcancel10%
kcancel(self, event)
Context__init__0
__init__(self, process)
Contextuptime0
uptime = staticmethod(time.elapsed)
Contexttime0
time = staticmethod(time.utc)
Context_defer_reference
_defer_reference = None
Context_defer_execute100%
_defer_execute(self)
Execute all tasks whose wait period has elapsed according to the system's clock.
Contextdefer90%
defer(self, measure, *processors)
Defer the execution of the occur methods on the given processors by the given measure.
Contextcancel10%
cancel(self, processor)
Context_defer_update40%
_defer_update(self, snapshot)
Context_defer_period30%
_defer_period(self, current)
Context_defer_put325%int
_defer_put(self, current, measure, processors)
Context_defer_get130%
_defer_get(self, current)
Contextstructure40%
structure(self)
Contextactuate0
actuate(self)
Contextconnect_process_signal30%
connect_process_signal(self, xact_context, callback, signal)
Contextconnect_process_exit180%
connect_process_exit(self, xact_context, callback, *processes)
Contextallocate0
allocate(self, xactctx)
Launch an Executable for running application processors.
Contextreport30%
report(self, target)
Send an overview of the logical process state to the given target.
Context_recur40%
_recur(self, frequency, task)
Schedule the task for execution after the period of time measure elapses.
core.Scheduler instances will resubmit a task if there is a substantial delay remaining. When large duration defers are placed, the seconds unit are used and decidedly inexact, so resubmission is used with a finer grain.
Context_cancel20%
_cancel(self, task)
Cancel a scheduled task.
Contextinherit20%
inherit(self, context)
Inherit the exports from the given context.
Context_io_cycle20%
_io_cycle(self)
Signal the Process that I/O occurred for this context.
Context_io_attach30%
_io_attach(self, *channels)
Context_io_flush50%
_io_flush(self)
Contextexecute20%
execute(self, controller, function, *parameters)
Execute the given function in a thread associated with the specified controller.
Contextenviron40%
environ(self, identifier)
Access the environment from the perspective of the context. Context overrides may hide process environment variables.
Contextoverride50%
override(self, identifier, value)
Override an environment variable for the execution context.
Child processes spawned relative to the context will inherit the overrides.
Contextbindings30%
bindings(self, *allocs)
Returns a sequence of file descriptors that can later be acquired by a Matrix.
Contextconnect30%
connect(self, endpoint)
Given an endpoint and a transport stack, return the series used to manage the connection's I/O.
ContextconnectParameters
endpointThe library.Endpoint instance describing the target of the connection.
Contextallocate_transport30%
allocate_transport(self, fd)
Given a file descriptor and a transport stack, return the series used to manage the connection's I/O.
Contextallocate_transportParameters
Contextread_file30%
read_file(self, path)
Construct a channel for reading an entire file from the filesystem. The returned channel terminates when EOF occurs; often, read_file_range is preferrable to avoid status inconsistencies.
Contextwrite_file325%
write_file(self, path)
Construct a channel for writing to the file identified by path.
Contextread_file_range100%
read_file_range(self, path, start, stop)
Construct a channel to read a specific range of a file.
Contextappend_file30%
append_file(self, path)
Open a set of files for appending through a library.KernelPort.
Contextupdate_file50%
update_file(self, path, offset, size)
Allocate a channel for overwriting data at the given offset of the designated file.
Contextlisten40%
listen(self, interfaces)
On POSIX systems, this performs bind and listen system calls for receiving socket connections.
Returns a generator producing (interface, KAccept) pairs.
Contextaccept_sockets20%
accept_sockets(self, kp)
Construct a Channel processor that emite accepted listening sockets.
Contextconnect_output20%
connect_output(self, fd)
Allocate channel instances for the given sequence of file descriptors.
Contextconnect_input20%
connect_input(self, fd)
Allocate channel instances for the given sequence of file descriptors.
Contextdaemon156%tuple[int, int]
daemon(self, invocation)
Execute the fault.system.execution.KInvocation instance with stdin and stdout closed.
Returns the process identifier and standard error's file descriptor as a tuple.
Contextdaemon_stderr110%
daemon_stderr(self, stderr, invocation)
Execute the fault.system.execution.KInvocation instance with stdin and stdout closed. The stderr parameter will be passed in as the standard error file descriptor, and then closed before returning.
Returns a Subprocess instance containing a single Process-Id.
Used to launch a daemon with a specific standard error for monitoring purposes.
Contextsystem_execute20%
system_execute(self, invocation)
Execute the fault.system.execution.KInvocation inheriting standard input, output, and error.
This is used almost exclusively by shell-type processes where the calling process suspends TTY I/O until the child exits.
Contextcoprocess20%
coprocess(self, identifier, exit, invocation, application)
Dispatch a local parallel process.
Fabric0
Thread manager for processes; thread pool with capacity to manage dedicated threads.
Fabric__init__0
__init__(self, process)
Fabricvoid20%
void(self)
Normally used after a process fork in the child.
Fabricexecute20%
execute(self, controller, callable, *args)
Create a dedicated thread and execute the given callable within it.
Fabriccritical20%
critical(self, controller, context, callable, *args)
Create a dedicated thread that is identified as a critical resource where exceptions trigger fault.system.process.Critical exceptions in the main thread.
The additional context parameter is an arbitrary object describing the resource; often the object whose method is considered critical.
Fabricspawn30%
spawn(self, controller, callable, args)
Add a thread to the fabric. This expands the "parallel" capacity of a Process.
Fabricthread118%
thread(self, *parameters)
Manage the execution of a thread.
Fabricexecuting20%
executing(self, tid)
Whether or not the given thread [identifier] is executing in this Fabric instance.
Process0
The representation of the system process that is running. Usually referred to as process by Context and other classes.
Usually only one Process is active per-process, but it can be reasonable to launch multiple in order to perform operations that would otherwise expect its own space.
ProcessProperties
- fabric
The Fabric instance managing the threads controlled by the process.
Processcurrent50%
current()
Resolve the current logical process based on the thread's identifier. None is returned if the thread was not created by a Process.
Processtransaction0core.Transaction
transaction(self)
Return the primary library.Unit instance associated with the process.
Processkernel0
Processactuate_root_transaction0
actuate_root_transaction(self)
Processlog30%
log(self, data)
Append only access to a critical process log. Usually points to sys.stderr and primarily used for process related issues.
Processboot0
boot(self, *tasks)
Boot the Process with the given tasks enqueued in the Task queue.
Only used inside the main thread for the initialization of the controlling processor.
Processterminate60%
terminate(self)
Terminate the process closing the task queue and running the invocation's exit.
Process__init__0
__init__(self, exit, identifier)
Initialize the Process instance using the designated identifier. The identifier is essentially arbitrary, but must be hashable as it's used to distinguish one Representation from another. However, usually there is only one process, so "root" or "main" is often used.
Normally, execute is used to manage the construction of the Process instance.
Process_setup0
_setup(self)
Process_init_exit0
_init_exit(self)
Process_init_io0
_init_io(self)
Processvoid40%
void(self)
Tear down the existing logical process state. Usually used internally after a physical process fork.
Process__repr__10%
__repr__(self)
Processerror50%
error()
Handler for untrapped exceptions.
Processtitled_error10%
titled_error(self, title)
main_thread_task_queue
main_thread_task_queue = None
main_thread_interrupt
main_thread_interrupt = None
main_thread_exit_status
main_thread_exit_status = 255
reset40%
reset()
Reset the process global state of system.
exit50%
exit()
Default exit callback used to interrupt main thead task queue.
Sets the module attribute main_thread_exit_status to the given status and closes the main task queue.
spawn0Process
spawn(exit, identifier, executables)
Construct a Process using the given executables. The identifier is usually 'root' for the primary logical process.
dispatch0Process
dispatch(invocation, application)
Dispatch an application context instance within a new logical process.
Construct a Process and fault.kernel.core.Executable for executing the application context. The Process created by the inner spawn is returned.
reports30%
reports(link)
set_root_process140%
set_root_process(process)
Connect the system process termination signal to root transaction terminate.
default_error_trap60%
default_error_trap(link, call, error)
control0
control(**kw)
Control the main thread providing a low precision timer for deferred tasks. Called by an application's main entry point after booting the Process created by spawn.
protect753%
protect(error_control)