Replies: 8 comments 17 replies
-
|
Would we set up some retention policy ? |
Beta Was this translation helpful? Give feedback.
-
|
Can we add an enum for job name as well ? |
Beta Was this translation helpful? Give feedback.
-
|
Job type and job name will give us full clarity. Also, having job name as enum would ensure that we don't have arbitrary strings. |
Beta Was this translation helpful? Give feedback.
-
|
created_due_to looks a bit odd, Can we do something like: |
Beta Was this translation helpful? Give feedback.
-
|
Are we planning to store job specific metadata also ? |
Beta Was this translation helpful? Give feedback.
-
|
We can remove the CREATE TABLE IF NOT EXISTS superposition.job_manager (
id BIGINT PRIMARY KEY,
kronos_job_id TEXT NOT NULL,
type BACKGROUND_JOB_TYPE NOT NULL,
status BACKGROUND_JOB_STATUS NOT NULL,
name VARCHAR(15) NOT NULL,
progress INT NOT NULL DEFAULT 0,
workspace_schema TEXT,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
created_due_to TEXT NOT NULL
); |
Beta Was this translation helpful? Give feedback.
-
|
|
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
Superposition has invisible background jobs that happen in the system like webhook calls, priority recomputations, etc. which a user cannot see nor inspect, unless they have access to the infrastructure superposition is run on.
This proposal aims to define a structure for the background job manager (BJM), the interaction of BJM with Kronos, the types of background jobs that should be supported and where current invisible jobs get classified into.
List of all background jobs
Currently active
Jobs Enabled By BJM
Types of background jobs
Background jobs are classified by whether they will need to modify data in tables in workspace schema.
Modification Jobs
These are jobs that will be doing writes to the workspace schema over a period of time and will be impacted if any parallel changes occur while this happens. They will need to lock the workspace and for safety, set the config version of the workspace to the last working version (latest before changes). This guarantees no issues for clients or services resolving configs using superposition.
From the jobs list, the ones that fall into this are:
Processing jobs
These are jobs that read data and make API calls, but make no writes to the database with the exception of the bjm table.
From the jobs list, the ones that fall into this are:
Background Job Manager
The BJM table will exist in the global superposition schema. The table schema is below:
The workspace schema is NULLABLE because there are jobs that may exist to make workspace management easier. VIEWS of this table will be created in every workspace with the workspace_schema filter, so that workspace users can view the status of jobs without breaking data isolation. This may not be needed if we want to skip it, but is a nice to have.
How it works
Job scheduling and retries are managed by Kronos, and to show these attempts/setup/details to the user Superposition will reach out to kronos APIs to get the data using the kronos_job_id. The BJM only tracks the status of the job triggered in Superposition and its status and outcome. When a background job is scheduled in kronos, a corresponding job tracker will be added to BJM in superposition with the status
CREATED. If kronos responds with a 201 accepting the job, then the status is changed toSCHEDULED.It is recommended that background jobs are atomic and use transactions, but the design plans for cases where code must commit changes to the DB. To handle such cases or failures, all modification jobs when they start will set a config version for the workspace. When the job is triggered, they update the status to
INPROGRESSand based on the outcome will set the status to eitherFAILEDorCOMPLETED. The job can reschedule itself in case it fails, and the cycle repeats.Beta Was this translation helpful? Give feedback.
All reactions