Riberry

Riberry

  • Docs
  • Blog

›Design

Introduction

  • Overview
  • Installation

Configuration

  • Core
  • Application

Design

  • Overview
  • Core
  • Custom
  • Domain Model

Model Overview

Domain Model

High-level Flow

Job Execution States

Application Models

Application

Contains basic metadata related to an application.

Table: application

Class Path: riberry.model.application.Application

Columns

ColumnPrimary KeyTypeNullableDefaultComment
idYESINTEGERNO-
document_idNOINTEGERYESForeign key (document.id)
nameNOVARCHAR(64)NOThe human-readable name of the application.
internal_nameNOVARCHAR(256)NOThe internal name or secondary identifier of the application.
A brief description of the application's purpose.NOVARCHAR(256)YES-
typeNOVARCHAR(64)NOThe type of application.
enabledNOBOOLEANYESTrueWhether or not this application and its instances are enabled (TODO).

ApplicationInstance

An ApplicationInstance represents a running instance of an Application. Multiple ApplicationInstances are useful when we want to separate out different types of executions for the same Application.

An example of this is when we have an application which can support both long-running and short-running executions. We can spin up a separate instance with separate scheduling to ensure that the long-running jobs don't consume block the short-running jobs.

Table: app_instance

Class Path: riberry.model.application.ApplicationInstance

Columns

ColumnPrimary KeyTypeNullableDefaultComment
idYESINTEGERNO-
application_idNOINTEGERNOForeign key (application.id)
nameNOVARCHAR(64)NOThe human-readable name of the application.
internal_nameNOVARCHAR(256)NOThe internal name or secondary identifier of the application instance.

ApplicationInstanceSchedule

The ApplicationInstanceSchedule is a time-based schedule for dynamic parameters. It allows us to define parameters which change depending on the time of the day.

There are currently two core parameters: active and concurrency. These allow us to automatically activate/de-activate and scale up/down our applications during different times of the day.

Any custom parameter can be defined and consumed by our Celery application as long as we have a custom parameter handler in place which can interpret the parameter's values.

Table: sched_app_instance

Class Path: riberry.model.application.ApplicationInstanceSchedule

Columns

ColumnPrimary KeyTypeNullableDefaultComment
idYESINTEGERNO-
instance_idNOINTEGERNOForeign key (app_instance.id)
daysNOVARCHAR(27)NOComma-separated list of specific days ("MON,WED"), or "*" for every day.
start_timeNOVARCHAR(8)NO00:00:00The time when this schedule activates.
end_timeNOVARCHAR(8)NO23:59:59The time when this schedule de-activates.
timezoneNOVARCHAR(128)NOUTCThe timezone of for the given start and end times.
parameterNOVARCHAR(32)NOThe parameter which this schedule applies to.
valueNOVARCHAR(512)NOThe value of the given parameter.
priorityNOINTEGERNO64Priority of the schedule, where higher values mean higher priority.

Heartbeat

The Heartbeat object is used by running ApplicationInstances to report back that they're alive. If an ApplicationInstance's last heartbeat was over 10 seconds ago, we assume that it is offline.

Table: heartbeat_app_instance

Class Path: riberry.model.application.Heartbeat

Columns

ColumnPrimary KeyTypeNullableDefaultComment
idYESINTEGERNO-
instance_idNOINTEGERNOForeign key (app_instance.id)
createdNODATETIMEYESDATETIME (UTC)The first heartbeat we received for the instance.
updatedNODATETIMEYESDATETIME (UTC)The last heartbeat we received for the instance.

Auth Models

User

Table: users

Class Path: riberry.model.auth.User

Columns

ColumnPrimary KeyTypeNullableDefaultComment
idYESINTEGERNO-
usernameNOVARCHAR(48)NO-
passwordNOVARCHAR(512)YES-
auth_providerNOVARCHAR(32)NOdefault-

UserDetails

Table: user_details

Class Path: riberry.model.auth.UserDetails

Columns

ColumnPrimary KeyTypeNullableDefaultComment
idYESINTEGERNO-
user_idNOINTEGERNOForeign key (users.id)
first_nameNOVARCHAR(64)YES-
last_nameNOVARCHAR(64)YES-
display_nameNOVARCHAR(128)YES-
departmentNOVARCHAR(128)YES-
emailNOVARCHAR(128)YES-
updatedNODATETIMEYESDATETIME (UTC)-

Group Models

Group

Table: groups

Class Path: riberry.model.group.Group

Columns

ColumnPrimary KeyTypeNullableDefaultComment
idYESINTEGERNO-
nameNOVARCHAR(128)NO-
display_nameNOVARCHAR(128)YES-
descriptionNOVARCHAR(128)YES-

ResourceGroupAssociation

Table: resource_group

Class Path: riberry.model.group.ResourceGroupAssociation

Columns

ColumnPrimary KeyTypeNullableDefaultComment
idYESINTEGERNO-
group_idNOINTEGERNOForeign key (groups.id)
resource_idNOINTEGERNO-
resource_typeNOVARCHAR(4)NO-

Interface Models

ApplicationInterface

An ApplicationInterface defines a supported interface for an Application. An interface contains input file and value definitions which can be consumed.

ApplicationInterfaces are versioned, meaning you can have multiple interfaces with the same internal_name only if they have different versions.

Table: app_interface

Class Path: riberry.model.interface.ApplicationInterface

Columns

ColumnPrimary KeyTypeNullableDefaultComment
idYESINTEGERNO-
application_idNOINTEGERNOForeign key (application.id)
document_idNOINTEGERYESForeign key (document.id)
nameNOVARCHAR(64)NOThe human-readable name of the interface.
internal_nameNOVARCHAR(256)NOThe internal name or secondary identifier of the interface.
versionNOINTEGERNO1The version of the interface.
descriptionNOVARCHAR(256)YESA brief description of the interface's purpose.

Form

A Form is an implementation of an ApplicationInterface for a given ApplicationInstance.

All inputs a form accepts are defined by the ApplicationInterface it's linked to, and all Jobs created by the form belong to the linked ApplicationInstance.

Table: form

Class Path: riberry.model.interface.Form

Columns

ColumnPrimary KeyTypeNullableDefaultComment
idYESINTEGERNO-
instance_idNOINTEGERNOForeign key (app_instance.id)
interface_idNOINTEGERNOForeign key (app_interface.id)
enabledNOBOOLEANNOTrueWhether or not this form is enabled (TODO).

FormSchedule

Table: sched_form

Class Path: riberry.model.interface.FormSchedule

Columns

ColumnPrimary KeyTypeNullableDefaultComment
idYESINTEGERNO-
form_idNOINTEGERNOForeign key (form.id)
startNODATETIMENO-
endNODATETIMENO-

InputFileDefinition

The InputFileDefinition object defines the properties of an input file.

Table: input_file_definition

Class Path: riberry.model.interface.InputFileDefinition

Columns

ColumnPrimary KeyTypeNullableDefaultComment
idYESINTEGERNO-
application_interface_idNOINTEGERNOForeign key (app_interface.id)
nameNOVARCHAR(64)NO-
internal_nameNOVARCHAR(256)NO-
descriptionNOVARCHAR(128)YES-
typeNOVARCHAR(64)NO-
acceptNOVARCHAR(256)YES-
requiredNOBOOLEANNOTrue-

InputFileInstance

The InputFileInstance object contains data for a InputFileDefinition and is linked to a Job.

Table: input_file_instance

Class Path: riberry.model.interface.InputFileInstance

Columns

ColumnPrimary KeyTypeNullableDefaultComment
idYESINTEGERNO-
filenameNOVARCHAR(512)NO-
definition_idNOINTEGERNOForeign key (input_file_definition.id)
job_idNOINTEGERNOForeign key (job.id)
sizeNOINTEGERNO-
binaryNOBLOBYES-

InputValueDefinition

The InputFileDefinition object defines the properties of an input value.

Table: input_value_definition

Class Path: riberry.model.interface.InputValueDefinition

Columns

ColumnPrimary KeyTypeNullableDefaultComment
idYESINTEGERNO-
application_interface_idNOINTEGERNOForeign key (app_interface.id)
nameNOVARCHAR(64)NO-
internal_nameNOVARCHAR(256)NO-
descriptionNOVARCHAR(128)YES-
typeNOVARCHAR(64)NO-
requiredNOBOOLEANNOTrue-
defaultsNOBLOBYES-

InputValueEnum

The InputValueEnum object defines a valid enumeration for a given InputValueInstance.

Table: input_value_enum

Class Path: riberry.model.interface.InputValueEnum

Columns

ColumnPrimary KeyTypeNullableDefaultComment
idYESINTEGERNO-
definition_idNOINTEGERNOForeign key (input_value_definition.id)
valueNOBLOBNO-

InputValueInstance

The InputValueInstance object contains data for a InputValueDefinition and is linked to a Job.

Table: input_value_instance

Class Path: riberry.model.interface.InputValueInstance

Columns

ColumnPrimary KeyTypeNullableDefaultComment
idYESINTEGERNO-
definition_idNOINTEGERNOForeign key (input_value_definition.id)
job_idNOINTEGERNOForeign key (job.id)
valueNOBLOBYES-

Job Models

Job

A Job is an object which represents a set of inputs provided to a form. A Job can have one or more JobExecutions which represent the execution of the linked ApplicationInterface on the linked ApplicationInstance for the given input stored against this Job.

Jobs are immutable. If we require a different set of values, we'll need to create a new Job.

Table: job

Class Path: riberry.model.job.Job

Columns

ColumnPrimary KeyTypeNullableDefaultComment
idYESINTEGERNO-
form_idNOINTEGERNOForeign key (form.id)
creator_idNOINTEGERNOForeign key (users.id)
nameNOVARCHAR(64)NOThe unique name of our job.
createdNODATETIMENODATETIME (UTC)-

JobExecution

A JobExecution represent a single execution of our Job.

Table: job_execution

Class Path: riberry.model.job.JobExecution

Columns

ColumnPrimary KeyTypeNullableDefaultComment
idYESINTEGERNO-
job_idNOINTEGERNOForeign key (job.id)
creator_idNOINTEGERNOForeign key (users.id)
task_idNOVARCHAR(36)YESThe internal identifier of our job execution. This is usually the Celery root ID.
statusNOVARCHAR(24)YESRECEIVEDThe current status of our job execution.
createdNODATETIMENODATETIME (UTC)-
startedNODATETIMEYES-
completedNODATETIMEYES-
updatedNODATETIMENODATETIME (UTC)-
priorityNOINTEGERNO64The priority of this execution. This only applies to tasks in the RECEIVED state.

JobExecutionArtifact

Table: job_artifact

Class Path: riberry.model.job.JobExecutionArtifact

Columns

ColumnPrimary KeyTypeNullableDefaultComment
idYESINTEGERNO-
job_execution_idNOINTEGERNOForeign key (job_execution.id)
stream_idNOINTEGERYESForeign key (job_stream.id)
nameNOVARCHAR(128)NO-
typeNOVARCHAR(6)NO-
categoryNOVARCHAR(128)NODefault-
filenameNOVARCHAR(512)NO-
createdNODATETIMENODATETIME (UTC)-
sizeNOINTEGERNO-

JobExecutionArtifactBinary

Table: job_artifact_binary

Class Path: riberry.model.job.JobExecutionArtifactBinary

Columns

ColumnPrimary KeyTypeNullableDefaultComment
idYESINTEGERNO-
binaryNOBLOBYES-
artifact_idNOINTEGERNOForeign key (job_artifact.id)

JobExecutionArtifactData

Table: job_artifact_data

Class Path: riberry.model.job.JobExecutionArtifactData

Columns

ColumnPrimary KeyTypeNullableDefaultComment
idYESINTEGERNO-
titleNOVARCHAR(64)NO-
descriptionNOVARCHAR(512)NO-
artifact_idNOINTEGERNOForeign key (job_artifact.id)

JobExecutionStream

Table: job_stream

Class Path: riberry.model.job.JobExecutionStream

Columns

ColumnPrimary KeyTypeNullableDefaultComment
idYESINTEGERNO-
job_execution_idNOINTEGERNOForeign key (job_execution.id)
task_idNOVARCHAR(36)YES-
nameNOVARCHAR(64)YES-
statusNOVARCHAR(24)YESQUEUED-
createdNODATETIMENODATETIME (UTC)-
startedNODATETIMEYES-
completedNODATETIMEYES-
updatedNODATETIMENODATETIME (UTC)-

JobExecutionStreamStep

Table: job_stream_step

Class Path: riberry.model.job.JobExecutionStreamStep

Columns

ColumnPrimary KeyTypeNullableDefaultComment
idYESINTEGERNO-
stream_idNOINTEGERNOForeign key (job_stream.id)
task_idNOVARCHAR(36)YES-
nameNOVARCHAR(64)YES-
statusNOVARCHAR(24)YESRECEIVED-
createdNODATETIMENODATETIME (UTC)-
startedNODATETIMEYES-
completedNODATETIMEYES-
updatedNODATETIMENODATETIME (UTC)-

JobSchedule

A JobSchedule object defines a schedule which will trigger an execution for the linked Job.

Note that a JobExecution will only be created for an ApplicationInstance which has a status of "online". Applications which are offline or inactive due to an ApplicationInstanceSchedule will not have JobExecutions created.

Table: sched_job

Class Path: riberry.model.job.JobSchedule

Columns

ColumnPrimary KeyTypeNullableDefaultComment
idYESINTEGERNO-
job_idNOINTEGERNOForeign key (job.id)
creator_idNOINTEGERNOForeign key (users.id)
enabledNOBOOLEANNOTrueWhether or not this schedule is active.
cronNOVARCHAR(24)NOThe cron expression which defines our schedule.
createdNODATETIMENODATETIME (UTC)The time our schedule was created.
last_runNODATETIMEYESThe last time a job execution was created from our schedule.
limitNOINTEGERYES0The amount of valid runs for this schedule.
total_runsNOINTEGERYES0The total amount of runs for this schedule.

Misc Models

Document

Table: document

Class Path: riberry.model.misc.Document

Columns

ColumnPrimary KeyTypeNullableDefaultComment
idYESINTEGERNO-
typeNOVARCHAR(24)NOmarkdown-
contentNOBLOBNO-

Event

Table: event

Class Path: riberry.model.misc.Event

Columns

ColumnPrimary KeyTypeNullableDefaultComment
idYESINTEGERNO-
nameNOVARCHAR(64)NO-
timeNOFLOATNO-
root_idNOVARCHAR(36)NO-
task_idNOVARCHAR(36)NO-
dataNOVARCHAR(1024)YES-
binaryNOBLOBYES-

Notification

Table: notification

Class Path: riberry.model.misc.Notification

Columns

ColumnPrimary KeyTypeNullableDefaultComment
idYESINTEGERNO-
typeNOVARCHAR(7)NONotificationType.info-
messageNOVARCHAR(128)NO-

NotificationTarget

Table: notification_target

Class Path: riberry.model.misc.NotificationTarget

Columns

ColumnPrimary KeyTypeNullableDefaultComment
idYESINTEGERNO-
notification_idNOINTEGERNOForeign key (notification.id)
targetNOVARCHAR(128)NO-
target_idNOVARCHAR(128)NO-
actionNOVARCHAR(32)YES-

UserNotification

Table: notification_user

Class Path: riberry.model.misc.UserNotification

Columns

ColumnPrimary KeyTypeNullableDefaultComment
idYESINTEGERNO-
user_idNOINTEGERNOForeign key (users.id)
notification_idNOINTEGERNOForeign key (notification.id)
createdNODATETIMEYESDATETIME (UTC)-
readNOBOOLEANNOFalse-
← Custom Celery Workflows
  • Domain Model
  • High-level Flow
  • Job Execution States
  • Application Models
    • Application
    • ApplicationInstance
    • ApplicationInstanceSchedule
    • Heartbeat
  • Auth Models
    • User
    • UserDetails
  • Group Models
    • Group
    • ResourceGroupAssociation
  • Interface Models
    • ApplicationInterface
    • Form
    • FormSchedule
    • InputFileDefinition
    • InputFileInstance
    • InputValueDefinition
    • InputValueEnum
    • InputValueInstance
  • Job Models
    • Job
    • JobExecution
    • JobExecutionArtifact
    • JobExecutionArtifactBinary
    • JobExecutionArtifactData
    • JobExecutionStream
    • JobExecutionStreamStep
    • JobSchedule
  • Misc Models
    • Document
    • Event
    • Notification
    • NotificationTarget
    • UserNotification
Riberry
Docs
Getting Started (or other categories)Guides (or other categories)API Reference (or other categories)
Community
User ShowcaseStack OverflowProject ChatTwitter
More
BlogGitHubStar
Facebook Open Source
Copyright © 2018 Shady Rafehi