Jobs

Jobs handle the execution of one-time and repeated tasks. Northflank Jobs - just like Services - rely on Docker images that are

  • built from the commits of a linked Git repository,
  • and executed on the Northflank cloud platform.

There are two types of Jobs:

  • Normal Jobs, run manually
  • Cron Jobs, scheduled to run repeatedly

In the following sections we cover how to create, manage and delete them.

Creating a Job

To create a new Job:

  1. Navigate to your Project
  2. Select Job from the Create new drop-down menu in the top right corner of the screen
  3. Select Normal or Cron as the job type
  4. Type in a Job Name and a Description
  5. If you selected the Cron Job type, enter a Schedule. See explanation below.
  6. Select a Git Provider
  7. Select the Project Repository and Project Branch
  8. Specify a Build Context and Dockerfile location if necessary
  9. Click Verify to verify your Dockerfile
  10. Select a Plan
  11. Finish by clicking Create Job
Create a job

Job Schedule

The Cron Job Schedule is a cron expression. It consists of five fields representing the time at which to execute a specified command.

* * * * *
| | | | |
| | | | |___ day of week (0-6) (Sunday is 0)
| | | |_____ month (1-12)
| | |_______ day of month (1-31)
| |_________ hour (0-23)
|___________ minute (0-59)

note

For simple cron expressions you have option to use the following variables: @yearly, @annually, @monthly, @weekly, @daily or @hourly.

Editing a Job

You can change different aspects of a Job's configuration, such as schedule, Docker-related variables and scaling.

Job Settings

Retry Limit

You can specify the maximum number of attempts to run a job before it is marked as failed.

Time Limit

You can specify (in seconds) the maximum amount of time for a job to run, whether it has failed or not. This will take precedence over the Retry Limit. For example, if you set a Retry Limit of 6, and a Time Limit of 480, the job will be terminated after 8 minutes even if it has only attempted to run 4 times.

Cron Settings

Schedule

You can update the Cron schedule the following way:

  1. Select the Configuration tab
  2. Select Job Settings from the menu bar
  3. Type in the desired Cron expression
  4. Click Submit

Concurrency Policy

Choose whether to allow this job to run while another instance of the job is running, or to replace the currently running instance.

Allow will enable multiple instances of this job to run. Forbid will keep the current instance of the job running and stop a new instance from being run. Replace will terminate any currently running instance of the job and start a new one.

Start Time Limit

You can choose not to start a job if it fails to start within a specified time limit. You must specify the limit in seconds.

For example, if you set a Retry Limit of 6 and a Time Limit of 480, the job will terminate after 8 minutes regardless of how many times it attempted to run.

Build Parameters

Add, edit, or delete Build parameters.

Environment Variables

Add, edit, or delete Environment variables.

Scaling

Choose to make the job free or change the paid plan. Read more about plans.

Billing

View the charges associated with the job to inform your decisions on Scaling, or delete the job.

Managing Job Runs

The Continuous Integration and Delivery features within Northflank are also relevant for Jobs. Two settings are responsible for managing their behavior: Build latest and Use latest build.

Build latest is active by default. Every new commit to the linked repository will automatically result in a new build. If Use build latest is activated, new Job runs will automatically use the latest available image.

The toggle controls for switching these behaviors on and off are located in the top right-hand corner of the screen.

You can see all the latest commits, recent builds and Job runs in the Overview tab.

Running a Job

As already mentioned Normal Jobs run once upon creation.

To manually run a Job:

  • Click Run (play icon) in the top right side of the screen
  • Confirm Run job in the resulting modal

Cron Jobs run automatically as scheduled. They can be suspended using the Job active toggle to the left of the play icon.

Pausing a Job

To pause a Job:

  • Click Pause (pause icon) in the top right side of the screen
  • Confirm Pause job in the resulting modal

Pausing a job will:

  • disable continuous integration and deployment (toggling Build latest and Use latest build),
  • and in the case of Cron Jobs suspend scheduled runs (Job active toggle).

Builds

Here you can manually create new builds and view the logs of current and past builds.

Job Runs

A list of past running, successful, failed and deleted Job runs. Clicking on a run provides access to its logs. Running jobs can be aborted.

Deleting a Job

You can delete a job from the billing page. This will immediately remove the job and you will be billed for all usage to date.

© 2020 Northflank Ltd. All rights reserved.

TermsPrivacy

contact@northflank.com