-
Notifications
You must be signed in to change notification settings - Fork 93
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
Add prototype support for an ak.apply
function
#3963
Conversation
8a58f08
to
6df58b5
Compare
The CI failures appear unrelated to the contents of this PR |
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.
@jabraham17 -- thanks for this PR. I left some comments.
@ajpotts -- I see that Jade has some questions for you in the PR, could you take a look?
Do you have an idea how to mitigate this? It sounds like the second time you cloudpickle a numpy function, it is not playing well with the server, is that correct? Could the server cache functions? Arguably, that will not prevent the client from resending them, but they can be ignored. Or ideally, client can maintain a state, in which the fact that a given function is cached by the server can be stored. |
Its not just the use of the same function, its about the use of a module in a function. This snippet replicates the issue import arkouda as ak
import numpy as np
ak.connect()
n = 100_000
arr = ak.randint(0, 10, n)
def foo(x):
np
return 2.0
res = ak.apply(arr, foo, "float64")
print(res)
def bar(x):
np
return 1.0
res = ak.apply(arr, bar, "float64")
print(res) |
I have tracked down the crash to an issue with numpy and multiple interpreters: numpy/numpy#28271. This error should not crash the server (only throw an exception), so there is something on the Chapel Python interop side to fix. But this will just make a nicer error message, it will not fix the problem. For that, we either need to reusue the interpreter for each locale or numpy needs to be fixed. |
This is a general Chapel bug, there is nothing that can be done within the Python module to fix it |
dbe46ea
to
92e473a
Compare
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 love this so much!
Unfortunately I don't think we can merge it in until we can reduce the potential for server crashes.
e6b9703
to
f516dea
Compare
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.
Looks good! Thanks for all the hard work on this one.
9b871ce
to
eb07dbc
Compare
c3ccb36
to
994765c
Compare
add test case Signed-off-by: Jade Abraham <[email protected]> add test to ini Signed-off-by: Jade Abraham <[email protected]> add server msg Signed-off-by: Jade Abraham <[email protected]> add client code Signed-off-by: Jade Abraham <[email protected]> add support for arbitrary python code Signed-off-by: Jade Abraham <[email protected]> add more tests Signed-off-by: Jade Abraham <[email protected]> add python interop flags Signed-off-by: Jade Abraham <[email protected]> add compat modules Signed-off-by: Jade Abraham <[email protected]> add cloudpickle Signed-off-by: Jade Abraham <[email protected]> use non-generic function Signed-off-by: Jade Abraham <[email protected]> add stubs Signed-off-by: Jade Abraham <[email protected]> add missing dependency Signed-off-by: Jade Abraham <[email protected]> remove unused import Signed-off-by: Jade Abraham <[email protected]> format code nicely Signed-off-by: Jade Abraham <[email protected]> fix test Signed-off-by: Jade Abraham <[email protected]> skip tests if not supported Signed-off-by: Jade Abraham <[email protected]> ignore mypy errors for cloudpickle Signed-off-by: Jade Abraham <[email protected]> add missing cloudpickle deps Signed-off-by: Jade Abraham <[email protected]> apply reviewer feedback Signed-off-by: Jade Abraham <[email protected]> update server modules Signed-off-by: Jade Abraham <[email protected]> add ge-24 compat modules Signed-off-by: Jade Abraham <[email protected]> encode python version and reuse interpreters Signed-off-by: Jade Abraham <[email protected]> fix line length Signed-off-by: Jade Abraham <[email protected]> fix compat Signed-off-by: Jade Abraham <[email protected]> resolve limitation Signed-off-by: Jade Abraham <[email protected]> commit changes to ge-24 Signed-off-by: Jade Abraham <[email protected]> expose python version to server config Signed-off-by: Jade Abraham <[email protected]> fix typo Signed-off-by: Jade Abraham <[email protected]> wrap line Signed-off-by: Jade Abraham <[email protected]> improve tests Signed-off-by: Jade Abraham <[email protected]> update docs Signed-off-by: Jade Abraham <[email protected]> update test to use get_array_ranks Signed-off-by: Jade Abraham <[email protected]> add isPythonModuleSupported Signed-off-by: Jade Abraham <[email protected]> adjust problem size Signed-off-by: Jade Abraham <[email protected]> update test skipif Signed-off-by: Jade Abraham <[email protected]> fix flake errors Signed-off-by: Jade Abraham <[email protected]>
994765c
to
821ae4c
Compare
Adds prototypical support for calling an arbitrary python function on a distributed Arkouda array.
For example:
This PR uses
cloudpickle
to pickle arbitrary python code. The pickle is shipped to the server as base64, where it is depickled and executed.To use this module, there are new requirements for Arkouda.
arkouda_server
must be built with the same version of python that it will be run with.arkouda_server
's python version and the client's python version must be the same major/minor version.cloudpickle
must be available to thearkouda_server
, not just the clientarkouda_server