tomato package

tomato.set_loglevel(loglevel: int)
tomato.run_tomato()
tomato.run_ketchup()

Subpackages

Submodules

tomato.drivers: Shim interfacing with tomato driver packages

Code author: Peter Kraus

tomato.drivers.driver_to_interface(drivername: str) None | ModelInterface

tomato.models: Pydantic models for internal tomato use

Code author: Peter Kraus

pydantic model tomato.models.Driver

Bases: BaseModel

Show JSON schema
{
   "title": "Driver",
   "type": "object",
   "properties": {
      "name": {
         "title": "Name",
         "type": "string"
      },
      "port": {
         "anyOf": [
            {
               "type": "integer"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Port"
      },
      "pid": {
         "anyOf": [
            {
               "type": "integer"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Pid"
      },
      "spawned_at": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Spawned At"
      },
      "connected_at": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Connected At"
      },
      "settings": {
         "title": "Settings",
         "type": "object"
      }
   },
   "required": [
      "name"
   ]
}

field name: str [Required]
field port: int | None = None
field pid: int | None = None
field spawned_at: str | None = None
field connected_at: str | None = None
field settings: Mapping[str, Any] [Optional]
pydantic model tomato.models.Device

Bases: BaseModel

Show JSON schema
{
   "title": "Device",
   "type": "object",
   "properties": {
      "name": {
         "title": "Name",
         "type": "string"
      },
      "driver": {
         "title": "Driver",
         "type": "string"
      },
      "address": {
         "title": "Address",
         "type": "string"
      },
      "channels": {
         "items": {
            "type": "string"
         },
         "title": "Channels",
         "type": "array"
      },
      "pollrate": {
         "default": 1,
         "title": "Pollrate",
         "type": "integer"
      }
   },
   "required": [
      "name",
      "driver",
      "address",
      "channels"
   ]
}

Validators:
field name: str [Required]
field driver: str [Required]
field address: str [Required]
field channels: Sequence[str] [Required]
Validated by:
field pollrate: int = 1
validator coerce_channels  »  channels
pydantic model tomato.models.Component

Bases: BaseModel

Show JSON schema
{
   "title": "Component",
   "type": "object",
   "properties": {
      "name": {
         "title": "Name",
         "type": "string"
      },
      "driver": {
         "title": "Driver",
         "type": "string"
      },
      "device": {
         "title": "Device",
         "type": "string"
      },
      "address": {
         "title": "Address",
         "type": "string"
      },
      "channel": {
         "title": "Channel",
         "type": "string"
      },
      "role": {
         "title": "Role",
         "type": "string"
      },
      "capabilities": {
         "anyOf": [
            {
               "items": {
                  "type": "string"
               },
               "type": "array",
               "uniqueItems": true
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Capabilities"
      }
   },
   "required": [
      "name",
      "driver",
      "device",
      "address",
      "channel",
      "role"
   ]
}

Validators:
field name: str [Required]
field driver: str [Required]
field device: str [Required]
field address: str [Required]
field channel: str [Required]
Validated by:
field role: str [Required]
field capabilities: set[str] | None = None
validator coerce_channel  »  channel
pydantic model tomato.models.Pipeline

Bases: BaseModel

Show JSON schema
{
   "title": "Pipeline",
   "type": "object",
   "properties": {
      "name": {
         "title": "Name",
         "type": "string"
      },
      "ready": {
         "default": false,
         "title": "Ready",
         "type": "boolean"
      },
      "jobid": {
         "anyOf": [
            {
               "type": "integer"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Jobid"
      },
      "sampleid": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Sampleid"
      },
      "components": {
         "items": {
            "type": "string"
         },
         "title": "Components",
         "type": "array"
      }
   },
   "required": [
      "name"
   ]
}

field name: str [Required]
field ready: bool = False
field jobid: int | None = None
field sampleid: str | None = None
field components: Sequence[str] [Optional]
pydantic model tomato.models.Job

Bases: BaseModel

Show JSON schema
{
   "title": "Job",
   "type": "object",
   "properties": {
      "id": {
         "anyOf": [
            {
               "type": "integer"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Id"
      },
      "payload": {
         "title": "Payload"
      },
      "jobname": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Jobname"
      },
      "pid": {
         "anyOf": [
            {
               "type": "integer"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Pid"
      },
      "status": {
         "default": "q",
         "enum": [
            "q",
            "qw",
            "r",
            "rd",
            "c",
            "cd",
            "ce"
         ],
         "title": "Status",
         "type": "string"
      },
      "submitted_at": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Submitted At"
      },
      "executed_at": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Executed At"
      },
      "completed_at": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Completed At"
      },
      "jobpath": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Jobpath"
      },
      "respath": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Respath"
      },
      "snappath": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Snappath"
      }
   },
   "required": [
      "payload"
   ]
}

field id: int | None = None
field payload: Any [Required]
field jobname: str | None = None
field pid: int | None = None
field status: Literal['q', 'qw', 'r', 'rd', 'c', 'cd', 'ce'] = 'q'
field submitted_at: str | None = None
field executed_at: str | None = None
field completed_at: str | None = None
field jobpath: str | None = None
field respath: str | None = None
field snappath: str | None = None
pydantic model tomato.models.CompletedJob

Bases: BaseModel

Show JSON schema
{
   "title": "CompletedJob",
   "type": "object",
   "properties": {
      "id": {
         "title": "Id",
         "type": "integer"
      },
      "status": {
         "enum": [
            "c",
            "cd",
            "ce"
         ],
         "title": "Status",
         "type": "string"
      },
      "completed_at": {
         "title": "Completed At",
         "type": "string"
      },
      "jobname": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Jobname"
      },
      "jobpath": {
         "title": "Jobpath",
         "type": "string"
      },
      "respath": {
         "title": "Respath",
         "type": "string"
      }
   },
   "required": [
      "id",
      "status",
      "completed_at",
      "jobpath",
      "respath"
   ]
}

field id: int [Required]
field status: Literal['c', 'cd', 'ce'] [Required]
field completed_at: str [Required]
field jobname: str | None = None
field jobpath: str [Required]
field respath: str [Required]
pydantic model tomato.models.Daemon

Bases: BaseModel

Show JSON schema
{
   "title": "Daemon",
   "type": "object",
   "properties": {
      "status": {
         "enum": [
            "bootstrap",
            "running",
            "stop"
         ],
         "title": "Status",
         "type": "string"
      },
      "port": {
         "title": "Port",
         "type": "integer"
      },
      "verbosity": {
         "title": "Verbosity",
         "type": "integer"
      },
      "logdir": {
         "title": "Logdir",
         "type": "string"
      },
      "appdir": {
         "title": "Appdir",
         "type": "string"
      },
      "settings": {
         "title": "Settings",
         "type": "object"
      },
      "pips": {
         "additionalProperties": {
            "$ref": "#/$defs/Pipeline"
         },
         "title": "Pips",
         "type": "object"
      },
      "devs": {
         "additionalProperties": {
            "$ref": "#/$defs/Device"
         },
         "title": "Devs",
         "type": "object"
      },
      "drvs": {
         "additionalProperties": {
            "$ref": "#/$defs/Driver"
         },
         "title": "Drvs",
         "type": "object"
      },
      "cmps": {
         "additionalProperties": {
            "$ref": "#/$defs/Component"
         },
         "title": "Cmps",
         "type": "object"
      },
      "jobs": {
         "additionalProperties": {
            "anyOf": [
               {
                  "$ref": "#/$defs/Job"
               },
               {
                  "$ref": "#/$defs/CompletedJob"
               }
            ]
         },
         "title": "Jobs",
         "type": "object"
      },
      "nextjob": {
         "default": 1,
         "title": "Nextjob",
         "type": "integer"
      }
   },
   "$defs": {
      "CompletedJob": {
         "properties": {
            "id": {
               "title": "Id",
               "type": "integer"
            },
            "status": {
               "enum": [
                  "c",
                  "cd",
                  "ce"
               ],
               "title": "Status",
               "type": "string"
            },
            "completed_at": {
               "title": "Completed At",
               "type": "string"
            },
            "jobname": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Jobname"
            },
            "jobpath": {
               "title": "Jobpath",
               "type": "string"
            },
            "respath": {
               "title": "Respath",
               "type": "string"
            }
         },
         "required": [
            "id",
            "status",
            "completed_at",
            "jobpath",
            "respath"
         ],
         "title": "CompletedJob",
         "type": "object"
      },
      "Component": {
         "properties": {
            "name": {
               "title": "Name",
               "type": "string"
            },
            "driver": {
               "title": "Driver",
               "type": "string"
            },
            "device": {
               "title": "Device",
               "type": "string"
            },
            "address": {
               "title": "Address",
               "type": "string"
            },
            "channel": {
               "title": "Channel",
               "type": "string"
            },
            "role": {
               "title": "Role",
               "type": "string"
            },
            "capabilities": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array",
                     "uniqueItems": true
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Capabilities"
            }
         },
         "required": [
            "name",
            "driver",
            "device",
            "address",
            "channel",
            "role"
         ],
         "title": "Component",
         "type": "object"
      },
      "Device": {
         "properties": {
            "name": {
               "title": "Name",
               "type": "string"
            },
            "driver": {
               "title": "Driver",
               "type": "string"
            },
            "address": {
               "title": "Address",
               "type": "string"
            },
            "channels": {
               "items": {
                  "type": "string"
               },
               "title": "Channels",
               "type": "array"
            },
            "pollrate": {
               "default": 1,
               "title": "Pollrate",
               "type": "integer"
            }
         },
         "required": [
            "name",
            "driver",
            "address",
            "channels"
         ],
         "title": "Device",
         "type": "object"
      },
      "Driver": {
         "properties": {
            "name": {
               "title": "Name",
               "type": "string"
            },
            "port": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Port"
            },
            "pid": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Pid"
            },
            "spawned_at": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Spawned At"
            },
            "connected_at": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Connected At"
            },
            "settings": {
               "title": "Settings",
               "type": "object"
            }
         },
         "required": [
            "name"
         ],
         "title": "Driver",
         "type": "object"
      },
      "Job": {
         "properties": {
            "id": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Id"
            },
            "payload": {
               "title": "Payload"
            },
            "jobname": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Jobname"
            },
            "pid": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Pid"
            },
            "status": {
               "default": "q",
               "enum": [
                  "q",
                  "qw",
                  "r",
                  "rd",
                  "c",
                  "cd",
                  "ce"
               ],
               "title": "Status",
               "type": "string"
            },
            "submitted_at": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Submitted At"
            },
            "executed_at": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Executed At"
            },
            "completed_at": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Completed At"
            },
            "jobpath": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Jobpath"
            },
            "respath": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Respath"
            },
            "snappath": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Snappath"
            }
         },
         "required": [
            "payload"
         ],
         "title": "Job",
         "type": "object"
      },
      "Pipeline": {
         "properties": {
            "name": {
               "title": "Name",
               "type": "string"
            },
            "ready": {
               "default": false,
               "title": "Ready",
               "type": "boolean"
            },
            "jobid": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Jobid"
            },
            "sampleid": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Sampleid"
            },
            "components": {
               "items": {
                  "type": "string"
               },
               "title": "Components",
               "type": "array"
            }
         },
         "required": [
            "name"
         ],
         "title": "Pipeline",
         "type": "object"
      }
   },
   "required": [
      "status",
      "port",
      "verbosity",
      "logdir",
      "appdir",
      "settings"
   ]
}

Config:
  • arbitrary_types_allowed: bool = True

field status: Literal['bootstrap', 'running', 'stop'] [Required]
field port: int [Required]
field verbosity: int [Required]
field logdir: str [Required]
field appdir: str [Required]
field settings: dict [Required]
field pips: Mapping[str, Pipeline] [Optional]
field devs: Mapping[str, Device] [Optional]
field drvs: Mapping[str, Driver] [Optional]
field cmps: Mapping[str, Component] [Optional]
field jobs: Mapping[int, Job | CompletedJob] [Optional]
field nextjob: int = 1
pydantic model tomato.models.Reply

Bases: BaseModel

Show JSON schema
{
   "title": "Reply",
   "type": "object",
   "properties": {
      "success": {
         "title": "Success",
         "type": "boolean"
      },
      "msg": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Msg"
      },
      "data": {
         "anyOf": [
            {},
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Data"
      }
   },
   "required": [
      "success"
   ]
}

field success: bool [Required]
field msg: str | None = None
field data: Any | None = None