GATE
Run functions on a remote hub via an http server through a simple API. This greatly facilitates communication and sharing workloads across nodes in a JSON application.
INSTALLATION
pip install pop-gate
USAGE
Run the gate server from the command line and expose specific patterns of hub references. The ‘–refs’ represent patters on the hub that are allowlisted. The ‘–prefix’ tells gate to assume that all refs are under a specific dynamic namespace.
In this example we will use a prefix of “gate” and allow all refs under ‘hub.gate.init’
gate --prefix gate --refs "init.*"
Use curl to run hub.gate.init.test() on the remote server like so:
curl http://localhost:8080 -H "Content-Type: application/json" -d '{"ref": "init.test"}'
Keyword arguments can be passed by adding extra keys to the call:
curl http://localhost:8080 -H "Content-Type: application/json" -d '{"ref": "init.test", "args": ["arg1", "arg2"], "kwargs": {"kwarg1": "value1"}}'
TESTING
Install gate locally with testing libraries:
git clone git@gitlab.com:saltstack/pop/gate.git
pip install -e gate -r requirements-test.txt
Run the tests with pytest
pytest gate/tests
INTEGRATION
In order to use gate in your own project add the gate config to your conf.py like so:
my_project/conf.py
CLI_CONFIG = {
# Gate options
"host": {"source": "gate"},
"port": {"source": "gate"},
"server": {"source": "gate"},
"matcher": {"source": "gate"},
"prefix": {"source": "gate"},
"refs": {"source": "gate", "default": ["gate.init.test"]},
}
Add gate startup code to your project’s initializer like so:
my_project/my_project/init.py
def __init__(hub):
# Horizontally merge the gate dynamic namespace into your project
hub.pop.sub.add(dyne_name="gate")
def cli(hub):
# Load the config from gate onto hub.OPT
hub.pop.config.load(["my_project", "gate"], cli="my_project")
# Create the asyncio loop
hub.pop.loop.create()
# Get the default gate server, and other options from hub.OPT.gate
gate_server = hub.OPT.gate.server
# Create the server coroutine
coro = hub.gate.init.start(gate_server=gate_server)
# Start the gate server
hub.pop.Loop.run_until_complete(coro)
Metadata
Release files for pop-gate 4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pop-gate-4.tar.gz | 7.1 kB | Without provenance | Details for pop-gate-4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pop_gate-4-py3-none-any.whl | Python 3 | none | any | Details for pop_gate-4-py3-none-any.whl |
Total release size: 13.9 kB
Release files / pop-gate-4.tar.gz
| Download URL | pop-gate-4.tar.gz |
|---|---|
| Size | 7.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f49879659176400aa785986103d9da7dadcea5061dce6f02323ba10e81488a4d
|
|
BLAKE2b-256 checksum How to use checksums |
5f61198d3e8f1e23807b22ac0c5ef761507944ae461cd511a21ee8dfdc98a39c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1
|
Release files / pop_gate-4-py3-none-any.whl
| Download URL | pop_gate-4-py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
321712516f362e05ff45202bd743a15cd81063480094062b205114af538e075e
|
|
BLAKE2b-256 checksum How to use checksums |
aaf4dbd0fbc661fefd8021178490fe3aba0f3267defe7378b1cef5a2ac953fb4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1
|
Security for pop-gate 4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.