Repository navigation
Interactive fleet Sample - #502
Luke-Roy-IBM wants to merge 1 commit into
Conversation
b8f70bd to
b26d79e
Compare
Signed-off-by: Luke Roy <luke.roy@ibm.com>
b26d79e to
3f6f1f7
Compare
reggeenr
left a comment
There was a problem hiding this comment.
Great job, @Luke-Roy-IBM !
Apart from the comments related to adopting Trusted Profiles, I suggest to also move this example into the tutorials folder.
| - An IBM Cloud API key with **Code Engine Writer** and **COS Reader** access: | ||
| ```bash | ||
| export CE_API_KEY=<your-api-key> | ||
| ``` |
There was a problem hiding this comment.
Similar like in the other new tutorial, I suggest to adopt Trusted Profiles instead of requiring an API Key
| # Purpose: Receives a JSON payload as $1, enriches it, and writes the result | ||
| # to the COS mount at /data/results/interactive-fleet-result/{task_id}.json. | ||
| # --------------------------------------------------------------------------- | ||
| FROM registry.access.redhat.com/ubi10/ubi-minimal |
There was a problem hiding this comment.
I suggest to slightly adjust this example and make use of a distroless runtime image
There was a problem hiding this comment.
As this image is designed to be replaced with the actual fleet users task image i dont see any issue with using a generic approved ubi-minimal image
|
@reggeenr that is all good feedback thanks a lot. will implement |
|
@reggeenr if you are happy with this being v1 and getting merged i can work on the trusted profile support in the next iteration |
interactive-fleets — new sample
Adds
serverless-fleets/interactive-fleets, a general-purpose submit-and-poll patternthat turns any Code Engine Fleet workload into a synchronous HTTP API.
What it does
A Code Engine Function acts as an HTTP gateway to a fleet:
POST /orGET /— accepts arbitrary JSON input (or query parameters), generates a task ID,submits the input as a fleet task, and polls COS for the result for up to
POLL_TIMEOUTseconds.Returns HTTP 200 with the result if it arrives in time, or HTTP 202 with a
retrieve_urlif the poll window expires.
GET /result/{task_id}— retrieves a previously submitted result from COS at any time.The fleet task receives the full input payload as a single JSON string in
$1, processes it,and writes the result to a COS-mounted path. No message queue, no polling infrastructure —
just a function, a fleet, and a COS bucket.
What's included
deployfunction/__main__.pytask-container/entrypoint.sh$1, adds metadata, writes result to COS mounttask-container/DockerfileREADME.mdAuthentication
A single IBM Cloud API key (
CE_API_KEY) is used for both the CE Fleet API and COS accessvia IAM Bearer tokens.
Use cases
This pattern can be adapted for any fleet workload that needs an HTTP interface:
ML inference, document processing, data transformation, external API orchestration, or any
batch job that produces a result file.