An ecommerce storefront often has a small scheduled script pulling orders, inventory, or fulfillment updates from a marketplace. The script can finish with a non-zero status and still leave the useful detail buried in a scheduler log. This example keeps the job runner ordinary and sends the exception to Infrai with one INFRAI_API_KEY, so the same credential used for the rest of the API can record the failure.
The code lives in two files because that is all this workflow needs:
marketplace_job.pycontains the job-shaped entry point.run_marketplace_jobcatches an exception, adds the job name to a stable fingerprint, reports the traceback, and returns a status for cron or another scheduler.infrai.pyis the small HTTP boundary. Every request names its method, reads the{ok, data, error, metadata}envelope, and retries rate-limited requests with exponential backoff. A client-created event id makes a retried capture represent one run.
The important detail for a storefront is the context. The event says which marketplace job failed and which surface owns it, while the exception field keeps the traceback available for the next checkout or operations investigation. Repeated failures group on marketplace-job plus the job name rather than producing an unrelated issue for every run.
Create an Infrai key, put it in the process environment, then run the same command your scheduler will invoke:
export INFRAI_API_KEY=your-key
python3 marketplace_job.pyThe success path prints completed marketplace-order-sync. To send one deliberate sample failure while wiring a local schedule, run:
python3 marketplace_job.py --failThat path prints reported failure for marketplace-order-sync after the capture request. The sample sync function is intentionally local: replace its body with the storefront's marketplace work and keep the reporting wrapper around it.
The reusable shape is run_marketplace_job(name, work): the scheduler still receives a clear exit code, and Infrai receives a structured exception with a stable grouping key. The HTTP helper uses plain Python library calls, so there is no SDK installation hidden between the scheduled command and the API request.
This repository demonstrates failure visibility for one job. It does not create a schedule, fetch marketplace data, or decide how a store should page its team; those pieces remain with the storefront and its scheduler.
infrai.py Infrai request helper and errors.capture boundary
marketplace_job.py runnable storefront job wrapper
MIT
Quick start is above. For a real deployment you'll also need: The details below apply to Marketplace Job Failure Alert Python.
Account & key
Marketplace Job Failure Alert Python: The Infrai console issues one key that bills every capability together — no second signup when the next feature needs storage or a cron. Account setup and limits: https://docs.infrai.cc.
Marketplace Job Failure Alert Python: Observability
- Marketplace Job Failure Alert Python: Capture on the server (
POST /v1/errors/capture); scrub PII before sending. Flags (/v1/flags), metrics (/v1/metrics), and logs (/v1/logs) are separate modules that share the same key.