Learning Library

← Back to Library

Running Batch Jobs with IBM Code Engine

Key Points

  • Gabby Moreno introduces batch jobs on IBM Cloud Code Engine as container‑based tasks that run at scheduled times to process data, such as daily record updates.
  • In the Code Engine UI, she creates a new Job (not an Application) using the pre‑built “hmo‑task” container image, saving the definition so it can be executed repeatedly.
  • Before submitting, she explains that the demo job will process customer records, with a dashboard showing total records versus those already processed.
  • She configures the job’s “Array indices” to “1‑10” to launch ten parallel instances, noting that instance numbering can be customized to avoid overlapping work.
  • After submitting, the ten instances move through pending, running, and completed states, quickly updating the processed‑record count until all jobs finish successfully.

Full Transcript

# Running Batch Jobs with IBM Code Engine **Source:** [https://www.youtube.com/watch?v=3oZW1FejYno](https://www.youtube.com/watch?v=3oZW1FejYno) **Duration:** 00:04:04 ## Summary - Gabby Moreno introduces batch jobs on IBM Cloud Code Engine as container‑based tasks that run at scheduled times to process data, such as daily record updates. - In the Code Engine UI, she creates a new Job (not an Application) using the pre‑built “hmo‑task” container image, saving the definition so it can be executed repeatedly. - Before submitting, she explains that the demo job will process customer records, with a dashboard showing total records versus those already processed. - She configures the job’s “Array indices” to “1‑10” to launch ten parallel instances, noting that instance numbering can be customized to avoid overlapping work. - After submitting, the ten instances move through pending, running, and completed states, quickly updating the processed‑record count until all jobs finish successfully. ## Sections - [00:00:00](https://www.youtube.com/watch?v=3oZW1FejYno&t=0s) **Running Batch Jobs with IBM Cloud Code Engine** - A step-by-step walkthrough demonstrates how to create and configure a batch job in IBM Cloud Code Engine using a prebuilt container image, covering the selection of the Job type, default settings, and the purpose of processing customer records. - [00:03:14](https://www.youtube.com/watch?v=3oZW1FejYno&t=194s) **Rapid Batch Job Deployment with Code Engine** - The presenter demonstrates how, by specifying only a container image, a developer can launch a Code Engine job with ten parallel instances instantly—without any additional infrastructure setup—highlighting Code Engine’s ability to let developers focus solely on business logic. ## Full Transcript
0:00Hi everyone, my name is Gabby Moreno  Cesar and I'm with the IBM Cloud team. 0:05In this video we'll show you how to run batch  jobs with IBM Cloud Code Engine. Batch jobs 0:10are pieces of code meant to perform specific  tasks at certain times of day and then stop - 0:15for example, processing daily  records in a back-end system. 0:19So, starting at the Code Engine "overview"  page, we are going to choose the "Run your 0:23container image" option and give it the name  of a "batch" container image: "hmo-task" 0:30To save time, this image has  already been built for us. 0:34Let's go ahead and hit "Start creating"  to move on to the next step. 0:39On this screen we can enter many different  configuration options but for now let's just 0:45stick with the defaults for everything except  for the first one... for that we're going 0:50to choose "Job" instead of "Application". With that let's go ahead and hit "Create" 0:58We have now created the definition of our Batch  Job. Meaning, we didn't actually run it yet - we 1:04just made the platform aware of our Job. This  will allow us to run it over and over as needed. 1:14Before we actually run the job, let's  first talk about what the job will do. 1:19For this demo we have an application that manages  a set of customer records and our Job will process 1:27all of the customer records in our  backend system. You don't need to 1:30understand what the records are for, or what  this front-end application is that I'm showing. 1:36The key things here are the two numbers that  are from our backend system. The first shows 1:41the number of records in there, and the second  shows how many have been processed. As the batch 1:47job runs, the second number will increase and  eventually should equal the first number. 1:52Let's just keep this off to  the side so we can watch it. 1:59Let's now run the batch job by  hitting the "Submit job" button. 2:03You'll notice there are a few  options that we can modify. 2:07First, and foremost, is the 'Array indices' field. 2:10This tells Code Engine how many instances of the  job to execute. It's showing a default value of 2:16"1" - but this demo we're going to run 10  of them so we're going to enter "1-10" 2:23Code Engine allows for you to not only  specify how many instances to run, 2:27but how those instances are numbered. Meaning,  are they numbered 1, 2, 3... or should they be 2:34numbered 1,3,5,7, ... if we only want odd numbered  instances? Often the instance number is used a 2:43part of the processing to ensure each instance's  work doesn't overlap with any other's. 2:49We're going to leave the rest of the configuration  options alone and just press "Submit job". 2:56Notice in the window that we  have 10 pending instances. 3:01Each instance will eventually move from "pending",  to "running" and finally "completed" states 3:08Notice in the application window you can see the  number of records processed is going up... fast. 3:15And in a matter of seconds  all 10 jobs are completed 3:21Let's quickly summarize what happen though. With  just the name of a container image we defined 3:26a Job and then executed it with 10 instances.  We didn't have to do any other infrastructure 3:31setup or management. As a developer of this code,  all I had to worry about is the business logic of 3:39workload - nothing else. And that's the goal of Code 3:42Engine - allowing developers to focus  on what's important... coding. 3:46That's all the time we have today, but hopefully  you found this quick walk-thru of how to manage 3:50batch jobs in Code Engine exciting and I encourage  you to look at our other videos to see more key 3:56Code Engine features. And, of course, we hope that  you'll go to www.ibm.com/cloud/code-engine to play 4:02with it yourself. Thank you.