Workflow orchestration and management.
Project description
prefect-client
The prefect-client
package is a minimal-installation of prefect
which is designed for interacting with Prefect Cloud
or remote any prefect
server. It sheds some functionality and dependencies in exchange for a smaller installation size,
making it ideal for use in lightweight or ephemeral environments. These characteristics make it ideal for use in lambdas
or other resource-constrained environments.
Getting started
prefect-client
shares the same installation requirements as prefect. To install, make sure you are on Python 3.8 or
later and run the following command:
pip install prefect-client
Next, ensure that your prefect-client
has access to a remote prefect
server by exporting the PREFECT_API_KEY
(if using Prefect Cloud) and PREFECT_API_URL
environment variables. Once those are set, use the package in your code as
you would normally use prefect
!
For example, to remotely trigger a run a deployment:
from prefect.deployments import run_deployment
def my_lambda(event):
...
run_deployment(
name="my-flow/my-deployment",
parameters={"foo": "bar"},
timeout=0,
)
my_lambda({})
To emit events in an event driven system:
from prefect.events import emit_event
def something_happened():
emit_event("my-event", resource={"prefect.resource.id": "foo.bar"})
something_happened()
Or just interact with a prefect
API:
from prefect.client.orchestration import get_client
async def query_api():
async with get_client() as client:
limits = await client.read_concurrency_limits(limit=10, offset=0)
print(limits)
query_api()
Known limitations
By design, prefect-client
omits all CLI and server components. This means that the CLI is not available for use
and attempts to access server objects will fail. Furthermore, some classes, methods, and objects may be available
for import in prefect-client
but may not be "runnable" if they tap into server-oriented functionality. If you
encounter such a limitation, feel free to open an issue
describing the functionality you are interested in using and we will do our best to make it available.
Next steps
There's lots more you can do to orchestrate and observe your workflows with Prefect! Start with our friendly tutorial or explore the core concepts of Prefect workflows.
Join the community
Prefect is made possible by the fastest growing community of thousands of friendly data engineers. Join us in building a new kind of workflow system. The Prefect Slack community is a fantastic place to learn more about Prefect, ask questions, or get help with workflow design. All community forums, including code contributions, issue discussions, and slack messages are subject to our Code of Conduct.
Contribute
See our documentation on contributing to Prefect.
Thanks for being part of the mission to build a new kind of workflow system and, of course, happy engineering!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file prefect_client-2.20.14.tar.gz
.
File metadata
- Download URL: prefect_client-2.20.14.tar.gz
- Upload date:
- Size: 777.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d1102a460b669a760ad9e9bc7a5cf48cd0276259210c3404d61efe6fcd2e185 |
|
MD5 | fe6dfc3430524ae3a3edf9d6ae57f67b |
|
BLAKE2b-256 | 3b11e7e0e6387fb4f8c2210c887e432bcb7566b63eee610a6c280f5d6bb1ab8b |
File details
Details for the file prefect_client-2.20.14-py3-none-any.whl
.
File metadata
- Download URL: prefect_client-2.20.14-py3-none-any.whl
- Upload date:
- Size: 770.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0bc394c6c4a97df152e0af60963d9926b9dd8ea608c8ccd9ba26797a4b072aab |
|
MD5 | fe4d0435f431c970335fe1e6f84d5ffc |
|
BLAKE2b-256 | d5943dfd966b0eab1d3b5a879ecdabdfe8ac0628b053c078d563e2d54a4a61ba |