Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It's difficult to try out Dispatch today. Users either have to use ngrok to expose their test functions to the production Dispatch instance, or must manually fit the pieces together from the
dispatch.test
package (#86) to setup a local server that they can connect to.This PR introduces a front-end to the components in the
dispatch.test
package, via apython -m dispatch.test
command. Users can use this to quickly spin up a mock Dispatch server locally.The mock server is a very basic in-memory implementation of the Dispatch interface. It will dispatch function calls from a FIFO queue, and supports both polling and tail calls, but it doesn't have any scheduling capabilities implemented beyond that (e.g. adaptive concurrency control).
Example
When you start the server, it prints configuration for a local endpoint or stand-alone client:
By default, a static API key and verification key is used, so that users don't have to reconfigure their endpoints each time.
Here's an example endpoint with one function:
test.py
If I start the endpoint on the URL expected by the mock Dispatch server, I see that the function was called correctly: