Modular transports via a tractor.ipc
subpkg! #24
Open
goodboy
wants to merge 53 commits from
leslies_extra_appendix
into shm_apis
pull from: leslies_extra_appendix
merge into: goodboy:shm_apis
goodboy:pytest_pluginize
goodboy:one_ring_to_rule_them_all
goodboy:main
goodboy:structural_dynamics_of_flow
goodboy:ns_aware
goodboy:shm_apis
goodboy:ext_type_plds
goodboy:oco_supervisor_prototype
goodboy:hilevel_serman
goodboy:py313_support
goodboy:aio_abandons
goodboy:sc_super_proto_dgrams
goodboy:runtime_to_msgspec
goodboy:pkg_tidying
goodboy:multihost_exs
goodboy:uv_migration_pre_msgspec_in_runtime
goodboy:remote_inceptions
goodboy:ext_type_plds_XPS_BACKUP
goodboy:modden_spawn_from_client_req
goodboy:multihomed
goodboy:devx_subpkg
goodboy:asyncio_debugger_support
goodboy:ctx_cancel_semantics_and_overruns
goodboy:pre_pretty_struct_dep_commit_b54cb66
goodboy:ctx_cancel_semantics_and_overruns_REVERSED_FACEPALM
goodboy:uv_migration
goodboy:to_asyncio_refinery
goodboy:runtime_to_msgspec_XPS_BACKUP
goodboy:rae_message_packing
goodboy:msg_codecs
goodboy:old_msg_types
goodboy:asyncio_debug_mode
goodboy:pause_from_sync_w_greenback
goodboy:mv_to_new_trio_py3.11
goodboy:modden_spawn_from_client_req_XPS_BACKUP
goodboy:shielded_ctx_cancel
goodboy:dereg_on_oserror
goodboy:ctx_cancel_semantics_and_overruns_XPS_GH_BACKUP
goodboy:msgtypes
goodboy:master
goodboy:switch_to_pdbp
goodboy:proper_breakpoint_hooking
goodboy:drop_proc_actxmngr
goodboy:ctx_result_consumption
goodboy:readme_touchups
goodboy:ipython_integration
goodboy:breceiver_internals
goodboy:piker_pin
goodboy:ipc_failure_while_streaming
goodboy:deprecate_arbiter_addr
goodboy:prompt_on_ctrlc
goodboy:dun_unset_current_actor
goodboy:ipc_failwhilestream_backup
goodboy:macos_in_ci
goodboy:harden_cluster_tests
goodboy:eg_backup
goodboy:exceptiongroups
goodboy:egs_with_ctx_res_consumption
goodboy:debug_lock_blocking
goodboy:callable_key_maybe_open_context
goodboy:spawn_backend_table
goodboy:pin_pre_trio_0.22
goodboy:pytest_report_workaround
goodboy:lifetime_stack_tests
goodboy:we_bein_all_matchy
goodboy:debug_event_guard
goodboy:disable_win_ci
goodboy:alpha5
goodboy:signint_saviour
goodboy:sigintsaviour_citesthackin
goodboy:sigintsaviour_ci_worked
goodboy:aio_error_propagation
goodboy:drop_msgpack
goodboy:310_windows
goodboy:ci_sdist_install
goodboy:include_readme
goodboy:310_plus
goodboy:name_query
goodboy:sort_subs_results_infected_aio
goodboy:aio_explicit_task_cancels
goodboy:fence_mp
goodboy:sigint_ignore_in_pdb_repl
goodboy:sigint2
goodboy:msgpack_lists_by_default
goodboy:nspaths
goodboy:experimental_subpkg
goodboy:maybe_cancel_the_cancel_
goodboy:moar_timeoutz
goodboy:drop_old_nooz_files
goodboy:raise_runinactor_error
goodboy:win_ci_timeout
goodboy:alpha4
goodboy:infect_asyncio
goodboy:expected_ctx_cancelled
goodboy:new_mypy
goodboy:context_caching
goodboy:end_of_channel_fixes
goodboy:agpl_commit_msg_fix
goodboy:agpl
goodboy:stricter_context_starting
goodboy:acked_backup
goodboy:faster_daemon_cancels
goodboy:early_deth_fixes
goodboy:clusters_and_hot_tips
goodboy:alpha3
goodboy:pubsub_startup_response_msg
goodboy:iaio_backup
goodboy:trionics
goodboy:graceful_gather
goodboy:246_facepalm_backup
goodboy:patch-async-enter-all
goodboy:immediate_remote_cancels
goodboy:less_logging
goodboy:zombie_lord_infinite
goodboy:optional_msgspec_support
goodboy:fix_kbi_in_ctx_block
goodboy:logo_tweaks
goodboy:use_trio_on_win
goodboy:alpha2
goodboy:msgspec_infect_asyncio
goodboy:live_on_air_from_tokio
goodboy:tokio_backup
goodboy:debugger_test_tweaks
goodboy:fix_news_links
goodboy:wats_da_nooz
goodboy:ctx_debugger
goodboy:bi_streaming_no_debugger_stuff
goodboy:round_2_ci_windows
goodboy:CI_increment_for_windows_bidirstreaming
goodboy:ctx_debugger_from_hardening
goodboy:infect_asyncio_backup
goodboy:debugger_hardening
goodboy:bi_streaming
goodboy:transport_cleaning
goodboy:context_finesse
goodboy:cf_backup
goodboy:db_backup
goodboy:pre_bad_close
goodboy:stdstream_clobber_fix
goodboy:bistream_backup
goodboy:transport_hardening
goodboy:msgspec_not_fucked
goodboy:try_msgspec
goodboy:prehardkill
goodboy:windows_bi_streaming
goodboy:docs_revamp
goodboy:new_docs_polish
goodboy:wip_fix_asyncio_gen_streaming
goodboy:drop_run
goodboy:mp_teardown_hardening
goodboy:stream_contexts
goodboy:drop_sync_funcs
goodboy:pub_connect_msg
goodboy:sync_cancel
goodboy:stream_clones
goodboy:first_pypi_release
goodboy:single_func_example
goodboy:readme_pump
goodboy:kinda_drop_run
goodboy:mp_hang_search
goodboy:eg_worker_poolz
goodboy:sync_breakpoint
goodboy:actor_state_via_messages
goodboy:we_aint_got_zombie_shields
goodboy:deprecate_rpcmodpaths
goodboy:implicit_runtime
goodboy:drop_tractor_run
goodboy:py3.9
goodboy:denoise_logging
goodboy:func_refs_always
goodboy:fix_debug_tests_in_ci_again
goodboy:stream_channel_shield
goodboy:pdb_madness
goodboy:advanced_debugger_testing
goodboy:clean_log_header
goodboy:debug_refine
goodboy:debug_refinements
goodboy:drop_warn
goodboy:multiproc_debug
goodboy:debugger_on_windows
goodboy:bug_in_debug
goodboy:debug_tests
goodboy:native_debugging
goodboy:matrix
goodboy:dereg_on_channel_aclose
goodboy:ensure_deregister
goodboy:start_up_sequence_trickery
goodboy:fix_win_ci_again
goodboy:stin_char_relay
goodboy:flaky_tests
goodboy:drop_cloudpickle
goodboy:reorg_entry_points
goodboy:drop-trip-update-trio
goodboy:init_sphinx_docs
goodboy:example_tests
goodboy:implicit_rpc
goodboy:fix_examples_in_docs
goodboy:try_trip
goodboy:log_task_context
goodboy:drop_event_clear
goodboy:more_thorough_super_tests
goodboy:pip_ci_fix
goodboy:windows_support
goodboy:rename_forkserver_mod
goodboy:user_update
goodboy:win_ci
goodboy:stream_functions
goodboy:propagate_loglevel
goodboy:ipc_iternals_renaming
goodboy:close_mem_chans
goodboy:docs_example_fixes
goodboy:spawn_method_support
goodboy:trio_memchans
goodboy:contexts
goodboy:remote_module_errors
goodboy:remote_task_cancelling
goodboy:fix_46
goodboy:loglevel_to_tractor_tests
goodboy:expose_tractor_test
goodboy:improved_errors
goodboy:self_register
goodboy:multi_program_tests
goodboy:tests_reorg
goodboy:type_annotations
goodboy:py3.7_tweaks
goodboy:reliable_cancel_tests
goodboy:attrs_it_up
goodboy:wait_for_actor
goodboy:draft_readme
goodboy:init_docs
goodboy:reg_with_uid
goodboy:forkserver_singleton
goodboy:drop_main_kwarg
goodboy:asyncgen_closing_fix
No reviewers
Labels
Clear labels
No items
No Label
Milestone
Clear milestone
No items
No Milestone
Projects
Clear projects
No project
Assignees
Clear assignees
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.
No due date set.
Dependencies
No dependencies set.
Reference: goodboy/tractor#24
Reference in New Issue
There is no content yet.
Delete Branch "leslies_extra_appendix"
Deleting a branch is permanent. Although the deleted branch may exist for a short time before cleaning up, in most cases it CANNOT be undone. Continue?
That’s right, we’re finally not just using TCP!
Bo
This originally started as a appendix PR to #17 and was thus named,
Now this PR will replace #17 since the history is to be fast forwarded onto the
structural_dynamics_of_flow
branch originally started by @guille (with much thanks!)The original description was,
PR land plan
I’d like to see this landed before the original upstream branch (#10) which contains the new (and much more experimental) high-perf shared-mem
.ipc._ringbug
stuff from @guille.So our first common commit between this and #10 should be,
9b21615
Break out transport protocol and tcp specifics into their own submodulesFrom the original history I’ve dropped the following commits that can instead go with #10:
bab265b
Important RingBuffBytesSender fix on non batched mode!010874b
Catch trio cancellation on RingBuffReceiver bg eof listener taskbe7fc89
Add direct ctx managers for RB channels2a9a786
Improve test_ringbuf testbe818a7
Switchtractor.ipc.MsgTransport.stream
type totrio.abc.Stream
ba353bf
Better encapsulate RingBuff ctx managment methodsAmendments to
tractor.ipc
and._addr
vs. original #17Much simplification to new
._addr.Address
primitives,UnwrappedAddress
,Address
type-var inheritance,Address.open_stream()
, never used.UDSAddress.unwrap()
to atuple[str, str]
of the(._filedir
,._filename)
pair, effectively the(Path.parent, Path.name)
components of a (new).sockpath: Path
..proto_key
andunwrapped_type
.namespace
as.bindspace
to both better reflect thesocket.bind()
argument significance as well as avoid collision with the linux semantics of “network namespaces” (which i’d like to utilize eventually!)..def_bindspace
attrs to each concrete type.Changes to
UDSAddress.bindspace: Path
semantic,_state.get_rt_dir()
as the default directory-value representing (in the same vein as a net-proto ip-address) the “basis of the bind space”, that is for socket-files which will be created under that directory-node.wrap_address()
and.from_addr()
to match.Actor.aid
info in the socket file name to indicate that process is the likely.listen()
er/server for that socket/file..close_listener()
sync.moved the
_addr.preferred_transport
to_state._def_tpt_proto: TransportProtocolKey = 'tcp'
extend
ipc._uds
for peer-credentials reading from the OS,open_unix_socket_w_passcred()
which ensures withsock.setsockopt()
that the server side can always read the connecting client’s pid.get_peer_info()
helper to read that^UDSAddress
s with the.maybe_pid
set from the peer on theraddr
for groking/introspection/repr purposes!new deps introduced,
bidict
for a 2way map._address_types: [str, Type[Address]]
.Changes to surrounding core components
add and use a new
Actor.aid: Aid
:Channel.aid/uid
to it^Aid.pid: int
field for getting any peer’s process id much more easily!.uuid
field from a new_addr.mk_uuid()
.add real
__repr__ = pformat
representations to,Actor
,Channel
,MsgPackTransport
(well ish, it’s a start),move
Actor._do_handshake()
toChannel
method.proper/rigorous
SpawnSpec
handling inActor._from_parent()
such that we actually raise an explicit internal error on type-mismatches (and not some weird downstream error..).add some new runtime excs,
RuntimeFailure
for out of our control init issues.ActorFailure
now from that for failed spawns.add a new
.devx.pformat.pformat_exc()
factored from the body ofRemoteActorError.pformat()
and used forTransportClosed
.factor out
breakpoint()
blocking to a_root.maybe_block_bp()
; should be factored to.devx
maybe ya?Full test suite multi-tpt support with
--tpt-proto=uds|tcp
I was able to augment the entire test to opt into multi-transport-protocols via a new accumulative
--tpt-proto
flag which by default is always just stored as['tcp']
as before.Now any opting in test/fixture can pass it to the
enable_transports: list[str]
argument exposed byopen_root_actor()
to test against that backend; currently we haven’t tried to test multiple protos together yet though!brief test harness updates summary
new
conftest
fixture content,tpt_protos: list[str]
rendered from CLI input args.tpt_proto: str
which just takes the first of the above for now.reg_addr
now correctly generates a random root-host-singleton-registry value per test session/run.set_script_runtime_args()
.test suite tweaks for UDS,
test_advanced_faults.py
adjustments for receiving non-KBIs since the socket “closure”/“breakage” will be relayed by the OS immediately.TransportClosed.src_exc
field for the raised underlyingtrio
exceptions.a new
test_root_runtime.py
suite with,test_only_one_root_actor
to verify we error on opening a 2nd root from an actor tree.test_implicit_root_via_first_nursery
which just verifies implicit root/runtime booting from the first opened.open_nursery()
.New
--dev
deps introducedpsutil
for proc introspection within the discovery suite.Follow up refinements I’d like to maybe see before #17 lands,
As in after this is merged into #17, I’d like to see these additional changes considered,
Address
into its.ipc/_tcp/uds
module.._addr
since there’s going to be extensions necessary as we start solving the multi-addresss idea and composition of tpt protos from addresses as kinda requested in https://github.com/goodboy/tractor/pull/367 with further follow up as we research the libp2p spec-docs:TransportServer
(singleton?-)wrapper which keeps track of all connections (SocketStream
s wrapped byMsgTransport
) per protocol and peer!.open/close_listener()
meths from per-tpt addrs-types and instead offering the api at module level for each proto?GH issues landing #17 will maybe close!
Refinements around multiple IPC transport protos, and appendix for #17to Refinements around multiple IPC transport protos (an appendix to #17)@ -48,2 +97,4 @@
# Lke, what use does this have besides a noop and if it's not
# valid why aren't we erroring on creation/use?
@property
def is_valid(self) -> bool:
i’m not really sure how useful this predicate is tbh.
@ -157,3 +267,1 @@
async def open_listener(self, **kwargs) -> trio.SocketListener:
listeners = await trio.open_tcp_listeners(
async def open_listener(
i think maybe we should consider moving this to
MsgpackTransport
as well?If it provides an interface around
SocketStream
-like instances (for each peer pair) i think it makes more sense to maybe do something like,await MsgpackUDSStream.open_listener(addr=UDSAddress.get_random())
instead of pulling weirdAddress()
-instance-internal state?@ -176,3 +285,1 @@
trio.SocketStream,
trio.SocketListener
]):
def unwrap_sockpath(
just a helper for any
UDSAddress..sockpath: Path
style partitioning to dir, filename.@ -67,3 +147,3 @@
# defaults are above
arbiter_addr: tuple[AddressTypes]|None = None,
arbiter_addr: tuple[UnwrappedAddress]|None = None,
REALLY need to drop this!
XD
i’m hoping to get to a follow up registry-sys rework this week in a follow up PR!
@ -61,0 +72,4 @@
# save an indent level?
#
@acm
async def maybe_block_bp(
NOTE most of the diff in this file is just the higher indent of
open_root_actor()
due to factoring this bp blocking stuff out!@ -202,3 +202,1 @@
self.uid = (
name,
uid or str(uuid.uuid4())
self._aid = msgtypes.Aid(
Notice we always stash the pid now!
@ -1199,0 +1342,4 @@
if (
'[Errno 98] Address already in use'
in
oserr.args#[0]
drop that
#[0]
bit..@ -146,0 +152,4 @@
_rtdir: Path = Path(os.environ['XDG_RUNTIME_DIR'])
def get_rt_dir(
used for our
UDSAddress.def_bindspace: path
44fd1ecc41
to8fd7d1cec4
Refinements around multiple IPC transport protos (an appendix to #17)to Modular transports via a `tractor.ipc` subpkg!Modular transports via a `tractor.ipc` subpkg!to Modular transports via a `tractor.ipc` subpkg!Wow it seems i can’t update the
pull_from
branch here!?that’s like nuts..
I guess if it can’t be done i’m going to have to open a new PR.. or just land this branch i guess..
800c99ac41
toc9e9a3949f
This is now replaced by an equiv PR from the branch from #17 onto
shm_apis
,https://github.com/goodboy/tractor/pull/375
Once i move desired content from the descr here to there i will be closing this one.
Step 1:
From your project repository, check out a new branch and test the changes.Step 2:
Merge the changes and update on Gitea.