<cajually>
is Alan Mosca here? or anyone else that participated in the implementation of the current decorator based python api
<SeanTAllen>
Alan is no longer working on Wallaroo. Nisan (who isnt on IRC at the moment, but should be in an hour or so) and aturley are most likely to have answers to questions. Is there something in particular you were looking to know cajually ?
<cajually>
Just some details in how the current way we are createing pickle:able decorated functions, it appears to work by accident in python2 based on the error messages I'm getting
<cajually>
I think I've found a way forward, just checking if there is someone with a lot more pickle experience than myself as it is a quite awkward module to work with
<SeanTAllen>
I think Nisan is the best person to talk to on that. I remember that was a particularly sticky area and if I remember correctly, it was Nisan who helped address. I'll drop him a note to swing by when he starts (he's on west coast of North America).
<cajually>
But it raises a larger question, why do we rely on pickle, is it because of ease of serialization?
<SeanTAllen>
We wanted to allow for a way for people to get started without having to worry about serialization. You can override it if you want, but its a good place to start.
<cajually>
It has imho a larger than desired capability to serialize python objects, I'm not sure that allowing a creep between function and state is best
<cajually>
but I've stepped between productivity and purity before..
<SeanTAllen>
We have considered having pickle as the default to be important to getting people using Wallaroo easily and then, issues around serializing differently can be raised. Serialization being a bit of an advanced concept that be a lot of cognitive overhead for folks starting out learning Wallaroo if we didn't provide a default.
<SeanTAllen>
That has been our thinking.
<cajually>
that is fair, sorry my hotel wifi is almost nonexistent
<cajually>
I think that having a good interface is very important and I realize a middle way where strictly state would be stored is never transparent, pickling can be tho
nisanharamati has joined #wallaroo
<SeanTAllen>
There are definitely tradeoffs. Serialization/deserialization is something we plan on revisting at some point, right now it isn't a top priority, but we have had a few discussions about things we could do in the future.
<nisanharamati>
Can also address lambdas at the same time (name them globally based on the hash of the `__code__` object or something like that)
<cajually>
I'll be back in 15min~
<cajually>
I mostly wanted to know if there was a strong opinion for pickle
<cajually>
nisanharamati: that is very related to an issue I'm having
<nisanharamati>
I'm glad it helps!
<cajually>
the local functools.wrapped old style classes can't be pickled in python 3
<cajually>
because the local classes can't be discovered and apparently this is explicitly not supported by pickle
<cajually>
I've been trying to change this into a decorator class builder builder pattern but that has the issue that the `def`:ed object is not that same as the decorated and breaks, because I can't use wraps
<cajually>
I'm sure there is some combination of these tools that will work and the best way to solve it is going to involve understanding pickle better
<cajually>
eh only one "decorator class builder pattern"
<cajually>
I can imagine that would be as impossible currently
<nisanharamati>
yeah
<nisanharamati>
but once you start doing name mangling an reassignment to the global scope like the POC in the code snippet in #1938, a lot of things become possible
<cajually>
I think there is a path forward here for sure
<nisanharamati>
e.g. in this instance, once you called the application builder with the lambda, the app builder identifies it as a lambda, recreates it as a regular function, and assigns it to the global scope, which then makes it pickleable
<cajually>
yeah that i definitely doable
<cajually>
we could grab the .name or .__name__, add something to make it unique and jam it in globals
<cajually>
pickle has weird restrictions for being stdlib
<nisanharamati>
it's also indeterminate in terms of how long pickling can take
<nisanharamati>
which is not ideal for a low-latency needs
<cajually>
anyway I like the idea of adding the __serialize__// __dese.. pseudo interface
<cajually>
check if those attrs exists and use them then otherwise use pickle format 3 o
moas has quit [Remote host closed the connection]
<nisanharamati>
I've got a bit of time before my next meeting, would you like me to whip up a branch with those changes applied to `wallaroo.py`, @cajually ?
<nisanharamati>
you can then rebase or cherry pick that into your work branch
<cajually>
I'm not yet familiar with what the process for such a change should look like
<cajually>
My branch so far is an exploration in what needs to be done for python2 and python3 support in machida, I think my machida supports python3 only now and the issues are entirely in pickling
<cajually>
what would be the best way to for you to spend your time on the python stuff I can't say. Do we expect anyone to be angry if we break the current API for example?
<SeanTAllen>
cajually: break in what sort of way? having python2 and python3 as different languages and APIs is something we expected to happen.
<cajually>
but it would be nice if wallaroo.py did the same thing as before once you ported your compute functions
<nisanharamati>
I think other than the pickling bit, our API is compatible with python 3
<cajually>
I get no other unit test failures
<nisanharamati>
Supporting new-style class pickling is beneficial for python2 as well
<cajually>
I agree
<nisanharamati>
it gives users the ability to base their state objects off of existing classes for example
<cajually>
Which I feel is the main reason to suport pickling
<cajually>
over say your state has to be a dict of primitive
<cajually>
nisanharamati: have you looked into using update_wrapper directly?
<cajually>
I was thinking that maybe we can avoid a closure by using a class also
<cajually>
as the decorator, but I guess we will still have one
<cajually>
But the best solution is probably the global solution we talked about earlier, it will definitely work
<nisanharamati>
The code in #1938 is loosely based on update_wrapper
<cajually>
Unless there is more magic in pickle that I don't know
<cajually>
ah of course
<nisanharamati>
update_wrapper lets you pickle
<nisanharamati>
but to unpickle, you need it in the global scope or you can't find it
<cajually>
it has to the it
<nisanharamati>
Once it's in global scope, you can also make some optimizations like using a local lookup table for functions instead of unpickling them
<cajually>
gah, my connection, I'm going to give up for tonight. I think that is solution is worth working on for sure
<cajually>
If you don't manage to get your code up in abranch that's ok, I can probably get enough of the snippoets working in my branch to get pickling working and tests passing tomorrow. Just gotta find a coworking space first:)
<cajually>
great talking tonight/mornig and see you later
moas has joined #wallaroo
moas has quit [Ping timeout: 260 seconds]
enilsen16_ has joined #wallaroo
Sargun_ has joined #wallaroo
jtfmumm_ has joined #wallaroo
jtfmumm has quit [*.net *.split]
enilsen16 has quit [*.net *.split]
Sargun has quit [*.net *.split]
jtfmumm_ is now known as jtfmumm
enilsen16_ is now known as enilsen16
rblasucci has quit [Quit: Connection closed for inactivity]
moas has joined #wallaroo
moas has quit [Ping timeout: 248 seconds]
* nisanharamati
update: PR is open for the changes discussed above. Hopefully all the tests pass and it can be merged before you start tomorrow, @cajually !
moas has joined #wallaroo
moas has quit [Ping timeout: 240 seconds]
<nisanharamati>
@cajually the updated API in `wallaroo.py` is now in `master`. Try rebasing your work off of the latest `master` code and see if it works!
<nisanharamati>
One thing to keep in mind: there's a lot of python2 glue code in the integration test harness. That glue does not need updating to Python3 as part of the project, as it's running machida, Go, and Pony based wallaroo application in subprocesses.
<nisanharamati>
Specifically, anything in `testing/tools/integration/`, and `testing/correctness/tests/` can be left alone for now Python2.
<nisanharamati>
*as python2
<nisanharamati>
I'm out for the rest of the day, but I'll check back here tomorrow morning and see how things are going.