Skip to content
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

enable asynchronous Arkouda client requests #2008

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

hokiegeek2
Copy link
Contributor

Hey guys,

This is a draft PR that covers the initial proof-of-concept for enabling asynchronous client-server comms in Arkouda utilizing asyncio.

There is currently an issue w/ pytest failures that I am investigating, but the code itself is working.

@hokiegeek2
Copy link
Contributor Author

example of async connect w/ delay:

arkouda-async-connect.mp4

example of async ones request w/ delay:

arkouda-asynchronous-ones-request.mp4

@hokiegeek2
Copy link
Contributor Author

just have to fix flake8 errors:

image

@hokiegeek2
Copy link
Contributor Author

all tests are now working:
image

Copy link
Member

@stress-tess stress-tess left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This super neat!! I don't know much about async io but nothing jumped out at me during my once over. Nice work!!! 🎉

Copy link
Contributor

@Ethan-DeBandi99 Ethan-DeBandi99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this looks really good. Just one note on documentation and one question regarding future maintenance.

Comment on lines +406 to +428
<a id="async_client"></a>
## Asynchronous Client

### Background

Arkouda has an alpha capability for enabling asynchronous client-server communications that provides feedback to users that a request has been submitted and is being processed within the Arkouda server. The initial asynchronous request capability supports multiuser Arkouda use cases where users may experience delays when the Arkouda server is processing requests by 1..n other users.

### Configuration

To enable asynchronous client communications, set the ARKOUDA_REQUEST_MODE environment variable as follows:

```
export ARKOUDA_REQUEST_MODE=ASYNC
```

### Exiting the Python shell

As of 01022023, exiting the Python shell in ASYNC request mode requires the following command:

```
ak.exit()
```

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this information something we would want in GitHub pages? I know that the updates to our documentation are still in progress, but I think this may be something beneficial to broadcast to a larger audience as its deployed.

Not 100% sure what the best place to put it would be, but I am thinking the top level for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ethan-DeBandi99 yeah, good point, should be at top-level

loop = get_event_loop()

def asyncEligible(cmd: str) -> bool:
return cmd not in {'delete', 'connect', 'getconfig'}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving forward, I am assuming we will have more commands if not all supported. Would we need to list every command here or would this be removed if we are supporting all commands?

Copy link
Member

@stress-tess stress-tess Jan 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might be wrong but I think this is saying every command except delete, connect, and getconfig is async eligible (i.e. will return True)

This is supported by the fact that one of the mp4s has asynchronous ak.ones which is not in this set of commands

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ethan-DeBandi99 ah, sorry, as @pierce314159 this checks to see if a method can be run in async mode. The reasons for the three are as follows:

  1. delete--since delete invokes del on pdarray, this cannot be run async b/c del is also invoked on Arkouda shell exit() and fails due to the resulting asyncio failing due to modules being deleted
  2. connect--this is because Python client connect method is itself async-enabled
  3. getconfig--this is invoked within the async Python client connect method, which, again, is itself async-enabled

@hokiegeek2
Copy link
Contributor Author

Here's an example of the "fire-and-forget" approach where the ak.connect() method is invoked and returns immediately. Once the request is actually returned, the user is prompted with the return message. This approach is different and handy in that the user can submit a request, continue working on something else, and then return to the workflow that spawned the request as shown below:

arkouda-connect-fire-and-forget.mp4

Copy link
Contributor

@jaketrookman jaketrookman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants