Embedded FastAPI Server¶
About The FastAPI Server¶
BluePepper has an embedded FastAPI server that starts when the application is launched. This allows you to run actions via web requests, letting you interact with BluePepper from outside (another DCC, another computer, etc.).
By default, the server runs on port 9999, but you can set a different port in the conf/fastapi.py configuration file.
Info
You may open multiple instances of BluePepper, but only one FastAPI server can run at a time. Thus, the first BluePepper instance you open will handle all requests.
Sending a Request¶
Out Of The Box Actions¶
Submitting a Batcher Job¶
Tip
The batcher is basically a way to run any piece of python code, as all arguments needed to create the job shall be passed through the request's payload.
Warning
Depending on your firewall's configuration, this can cause security issues. Use it wisely, and get in touch with your IT department to secure the FastAPI port.
from bluepepper.app.api.fastapi_client import run_bluepepper_app_action
run_bluepepper_app_action(
route="run_app_function/submit_batcher_job",
payload={
"name": "FastAPI Job",
"description": "This job was submitted using a web request",
"module": "bluepepper.toast",
"func": "show_message_toast",
"kwargs": {"message": "This job shows a toast"},
"priority": 100,
"notify_when_done": True,
"notify_message": "FastAPI job is now done",
},
)