-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
First attempt at removing trip & updating hazmat -> lowlevel #127
Conversation
@guilledk amazing 🥳, thanks for making an attempt at this. I cloned your branch and tried to run the suite with Task <bound method Actor.cancel of <tractor._actor.Actor object at 0x7fc8307a6880>> was likely cancelled before it was started
Traceback (most recent call last):
File "/home/goodboy/repos/tractor/tractor/_child.py", line 10, in <module>
cloudpickle.dump(sys.stdout.detach(), result)
File "/home/goodboy/repos/tractor/env/lib/python3.8/site-packages/cloudpickle/cloudpickle_fast.py", line 47, in dump
CloudPickler(file, protocol=protocol, buffer_callback=buffer_callback).dump(obj)
File "/home/goodboy/repos/tractor/env/lib/python3.8/site-packages/cloudpickle/cloudpickle_fast.py", line 429, in __init__
Pickler.__init__(self, file, protocol=protocol, buffer_callback=buffer_callback)
TypeError: file must have a 'write' attribute Traceback (most recent call last):
File "/usr/lib64/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib64/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/goodboy/repos/tractor/tractor/_child.py", line 13, in <module>
cloudpickle.dump(sys.stdout.detach(), err)
ValueError: underlying buffer has been detached /usr/lib64/python3.8/runpy.py:127: RuntimeWarning: 'tractor._child' found in sys.modules after import of package 'tractor', but prior to execution of 'tractor._child'; this may result in unpredictable behaviour
warn(RuntimeWarning(msg)) I think the last one might be fixed by changing the check for the spawn method in The other ones I'm note entirely sure what's going on yet; looks like stdio getting torn down too early? |
@guilledk the other thing is you dropped all the logging setup code in the child entrypoint which makes it so you can't see child logging which is really useful for debugging. |
@guilledk see my change set appended to yours: I think this should make the tests run clean 🏄♀️ Just a quick summary of what I changed:
|
@guilledk i made a PR to your branch so I think if you merge that and update then it should run the CI here? Also as discussed some cool things that we could add:
|
Drop trip update trio
@guilledk woot! Looks like tests passed but Also we're still seeing the errors from my earlier comment 😿 |
Hey so this commit is to check if the way I'm getting the actor from the passed arguments in Right now I just search the passed Next commit I'll also check the passed arguments in the |
@@ -153,6 +156,38 @@ async def cancel_on_completion( | |||
await portal.cancel_actor() | |||
|
|||
|
|||
@asynccontextmanager | |||
async def run_in_process(async_fn, *args, **kwargs): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make this simpler why don't we just make the signature of run_in_proc()
something like:
async def run_in_process(subactor, async_fn, *args, **kwargs):
debug_args = list(subactor.uid)
...
I do think it would be neat to accept these over sys.argv
in _child.py
and verify just as a sanity check.
It will for sure help with debugging using pstree
(or whatever).
Heck, maybe it actually makes more sense to do this without passing the Actor
type at all?
In theory we can avoid passing any complex types whatsoever as long as Actor._async_main()
receives the appropriate data that Actor.__init__()
normally does, 🤔.
Not sure if that's overthinking it.
I wonder if that means we could avoid cloudpickle
entirely?
We can maybe just use msgpack
in that case and load the module / func just like Actor._get_rpc_fun()
does (note it requires .load_modules()
to have been run first).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think at the least in terms of dropping cloudpickle
we should make an issue and tackle it later.
The multiprocessing.Process
call will need to be re-configured for this as well.
@guilledk try rebasing onto the latest Ideally we can factor out the commonalities into your branch but I've got to look through it. |
Closing in favor of the new #128. |
This branch started as an attempt to remove all
RuntimeWarnings
abouttrio.hazmat
deprecation but also turned into dropping ethereum/trio-run-in-process.tractor._child
which is the file that gets executed as a module whenrun_in_process
is called.I'm getting a bunch of fails on tests and hang, I'm pretty sure it has to do with the tractor machinery not being setup right in the newly spawned processes.