Scheduling Notebooks with SingleStore Job Service

A scheduled execution of a notebook is referred to as a Job. SingleStore Job service allows you to schedule your job according to a preferred time-based schedule. After scheduling, the job service creates a snapshot. This snapshot represents a read-only notebook captured at the time the job was scheduled. It can be used for subsequent executions at the scheduled time until the user makes modifications. To ensure that the execution reflects the new changes, be sure to update the snapshot explicitly after modifying the notebook.

You can create and manage scheduled jobs using the Cloud Portal or via the Management API.

Schedule Jobs using the Cloud Portal

Create a Scheduled Job

Jobs can be scheduled for shared notebooks only. You can create a scheduled job:

  1. Using Jobs in the left navigation

    Highlights the Jobs section in the left nav and the Schedule button in the Jobs page.
  2. Using Shared Notebooks

    1. Navigate to Data Studio > Shared .

    2. Select a shared notebook.

    3. Select Schedule (on the top right).

    Highlights the Schedule button in the Shared Notebook.

New Scheduled Job

After selecting Schedule, a dialog box will appear.

A dialog box having first step of Job Settings while creating new scheduled job.

Job Settings

Name

Enter a name for the job.

Description

Enter the job description.

Notebook

Select a shared notebook to run the job. The shared notebook is pre-selected when Job is scheduled through Notebooks.

Deployment

Select the SingleStore deployment (workspace) your notebook will connect to.

Selecting a workspace allows you to connect to your SingleStore databases referenced in the Notebook natively. You can also run a scheduled job without a deployment attached to it.

Select Next.

A New Scheduled Job dialog box having second step of adding Schedule Options.

Scheduled Options

Start Date & Time

Specify the date and time for the first run of the scheduled job. Select one of the following available options:

  1. Now: The job runs as soon as it is created.

  2. Datetime: Specify a Starting Date and Starting Time.

Schedule Mode

Specify the frequency to run a scheduled job. Select one of the following available options:

  1. One Time: The job runs a single time.

  2. Recurring: Specify the interval after which the next execution of the job can begin. The job runs after the specified interval once the prior execution is completed.

    1. For example, if a job that takes 5 minutes to complete is scheduled after 1 hour and the first job run is scheduled at 13:00, the next job run starts at 14:05.

    2. The minimum time interval is 1 hour and the maximum is 30 days.

Parameters

Specify your job parameters for the scheduled job. 

  1. Type: Select the type of parameters among String, Integer, Float, and Boolean.

  2. Name: Enter the name of the parameter.

  3. Value: Enter the value of the parameter.

Note

The system injects parameters as Python variables into the notebook while the scheduled job runs, and you can access them using the variables where required.

Additional Settings

  1. Save all execution results: Enable this setting to save the execution results. An execution result is a saved version of the notebook along with the cells containing outputs after the completion of a job run. This action enables you to validate the execution result and the version of the notebook used for the run. By default, all snapshots for error and failed runs are saved.

  2. Auto resume the deployment on job execution: Enable this setting to resume the deployment when the job runs. This action resumes any suspended workspace deployments. The previous auto-suspend settings of the workspace remain unchanged.

Select Next.

A New Scheduled Job dialog box with step 3 summarizing the previous steps input.

Select Create Job to schedule your job.

Manage an Existing Job

To view existing scheduled jobs and job runs, select Jobs in the left navigation pane. You view, edit, pause, resume, and delete a scheduled job.

View a Job

To view a job, select the job name under the Name column.

Job page having the job's name under the Name column.

You can view the following job execution details for each job:

Job execution details and Job details pane for an example job.

You can view the details of a job on the Job Details pane in the right navigation. You can also refresh, edit, pause, resume, and delete a job from this page.

Edit a Job

To edit an existing job, select Edit Job.

Shows how to edit a scheduled job. A dialog box for editing a scheduled job.

Pause a Job

To pause an existing job, select the ellipses in the Actions column of the job, and select Pause.

Resume a Job

To resume an existing job, select the ellipses in the Actions column of the job, and select Resume.

Shows the dialog box while resuming a scheduled job.

Delete a Job

To delete an existing job, select the ellipses in the Actions column of the job, and select Delete.

Warning

Deleting a job removes all associated job runs, including snapshots.

Schedule Jobs using the Management API

Use the Jobs path (/v1/jobs endpoint) to create and manage jobs using the Management API. Refer to Management API and Management API Reference for more information.

For example, the following API call returns information about the job with the specified jobID:

curl -X 'GET' \  'https://api.singlestore.com/v1/jobs/7b68b78d-0000-1000-9000-0864fd331524' \  -H 'accept: application/json'

Status of Job Executions

Status

Description

Scheduled

The next scheduled run for the job. The latest version of the notebook runs at the Start Time associated with the job.

Completed

The notebook in this job run ran to completion.

Failed

The execution failed due to user error. View execution result to debug the failure.

Error

An error unrelated to the notebook code prevented this job from completing. Refer to Troubleshoot Job Runs.

Troubleshoot Job Runs

SingleStore automatically saves an execution result notebook of an execution that fails. Navigate to Jobs in the left navigation, find your job, and download the snapshot associated with the failed job run to diagnose the error.

Error

Solution

Workspace Deleted

Edit the Job and select a deployment.

Workspace Suspended

Resume the workspace, or create a new job schedule with a different deployment.

Database Detached

Reattach the database with the right permissions or create a new schedule job with a different database.

Internal Errors / Misc

Reach out to SingleStore Support or use the chat feature in the Cloud Portal.

Notebook Timed Out

View the snapshot to identify the cells where the notebook is timed out.

Refer to Configurability and Key Considerations for the Execution Time limits set on a job run.

Notebook Deleted/Not present

Create a new scheduled job with a different notebook.

Configurability and Key Considerations

The snapshot version of a notebook runs at the scheduled start time. To make changes to a notebook without affecting a scheduled job run, create a duplicate of the notebook.

An execution time limit is set for each job run which is determined by the organization:

No Active Deployment

Active Starter Workspace in Free Shared Tier

Active Standard Workspace

Active Workspace in Enterprise Edition

Maximum allowed execution duration

5 minutes

15 minutes

15 minutes

30 minutes < x < 120 minutes.

Where x = Execution interval/5

Minimum execution interval

60 minutes

60 minutes

60 minutes

60 minutes

Maximum execution interval

30 days

30 days

30 days

30 days

Total active recurring jobs

1

5

5

30

Last modified: November 15, 2024

Was this article helpful?