Part 2 — Running a job
Nerd is designed around running (batch) jobs. A job is a computation that takes some input data, runs an application to do operations on this data and stores the results. Because applications are packaged as Images, no setup or configuration is necessary. A simulation is a great example: it takes some input dataset, runs the simulation and outputs the results.
We’ve created our own CO2 calculator and packaged it as an Image. It calculates the CO2 savings of the Nerdalize cloud. We’ll use it to show you how to use Nerd.
Starting a job
Running a basic job is as simple as starting it. You’ll have to provide the name of the application and it may be useful to give the job a name, so you can easily find it among your other jobs.
Our CO2 calculator is called nerdalize/co2-calculator. Run the following to run it:
$ nerd job run --name=co2-calc nerdalize/co2-calculator
Submitted job: 'co2-calc' To see whats happening, use: 'nerd job list'
Customizing your job using arguments
Many applications use arguments as a way to configure options or provide some input data. To do so when you run your application using Nerd, simply put the arguments after the image name.
Our CO2 calculator allows you to pass the number of homes. Run the following to run it for 30 households:
$ nerd job run --name=large-co2-calc nerdalize/co2-calculator 30
Submitted job: 'large-co2-calc' To see whats happening, use: 'nerd job list'
Viewing progress & log output
You’ve started two jobs now. To see all of your jobs and check up on them run:
$ nerd job list
All your jobs are listed below. To see the logs of a specific job, you can use: nerd job logs JOB-NAME Memory Usage: 0.0 / 12.8 GB (0.0%) vCPU Usage: 0.0 / 8.0 Core(s) (0.0%) JOB IMAGE INPUT OUTPUT MEMORY VCPU CREATED AT PHASE DETAILS large-co2-calc nerdalize/co2-calculator 1.1 1.0 6 seconds ago Completed co2-calc nerdalize/co2-calculator 1.1 1.0 13 seconds ago Completed
This shows you information about all of your jobs. Most importantly it shows you whether they’ve finished or whether they’re still running or waiting for resources to become available.
Applications also commonly generate logs that are shown in your Terminal if you run the application on your computer. You can also easily get this log output for any job run using Nerd.
To view the log output of your second job, run:
$ nerd job logs large-co2-calc
For 30 households, Nerdalize reduces CO2 emissions by 90,000 kg per year. This is equivalent to (per person): - 900,000 Kilometers by car, or 22.5 times around the world! 🚗 - 3,214,286 Kilometers by train, or 80.4 times around the world! 🚆 - 891,089 Kilometers by airplane, or 22.3 times around the world! ✈️
That’s how to run a job
nerd job run,
nerd job list &
nerd job logs to run a job and download its logs. Awesome! Let’s continue to the next part to learn about datasets and using them to run jobs with input and output files.