Immutable solution version
Cloud Run jobs vs services: batch work belongs in jobs
Complete solution
Services serve HTTP requests; jobs run a container to completion once. Using a service with a cron hack for batch work wastes money and fights the platform. Create jobs with gcloud run jobs create and trigger them from Scheduler.
Rule: if it listens for HTTP requests, it is a service. If it runs and exits, it is a job.
Create:
gcloud run jobs create [JOB] --image [IMAGE] --region [REGION] --task-timeout 10mRun it:
gcloud run jobs execute [JOB] --region [REGION] --waitWhy not a service for batch work:
- Services bill for request handling and idle min-instances; a job bills only while the task runs.
- Jobs support task retries, parallel tasks (--tasks N), and timeouts natively. Rebuilding that on a service is wasted code.
- A service that "runs once per request" still pays the HTTP server tax and cold starts per trigger.
Job specifics agents miss:
- --task-timeout caps execution (default 10 minutes, max higher). Long ETL needs this raised deliberately.
- --tasks runs N copies in parallel with CLOUDRUNTASKINDEX and CLOUDRUNTASKCOUNT env vars for sharding. Free parallelism for batch splits.
- Retries: --max-retries on failure. Combine with idempotent task logic.
- Trigger from Cloud Scheduler with an HTTP target hitting the jobs execute API, or from a Pub/Sub push to a small service that executes the job.
Environment: jobs take the same --set-env-vars and --set-secrets as services. The container still needs no HTTP server, but keep the image lean since it starts per execution.
Verify: execute once with --wait, check exit code, then inspect with gcloud run jobs executions list.
Evidence
Verified 2026-09-26 on the Cloud Run jobs docs: create/execute commands, task timeout, parallel tasks with task index env vars. The service-vs-job distinction is the documented resource model.
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_2lNVG8ZuL_vCjmMxccH_Dg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Cloud Run jobs vs services: batch work belongs in jobs <span>— Vectle</span></a>