-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move jobs to postgres Co-authored-by: Michał Praszmo <[email protected]>
- Loading branch information
Showing
6 changed files
with
163 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
from sqlmodel import SQLModel, Field, ARRAY, String, Column | ||
from typing import Optional, List, Union | ||
|
||
|
||
class JobBase(SQLModel): | ||
"""Base class for entities related to mquery jobs""" | ||
|
||
id: str | ||
status: str | ||
error: Optional[str] | ||
rule_name: str | ||
rule_author: str | ||
raw_yara: str | ||
submitted: int | ||
finished: Optional[int] | ||
files_limit: int | ||
reference: str | ||
files_processed: int | ||
files_matched: int | ||
files_in_progress: int | ||
total_files: int | ||
files_errored: int | ||
taints: List[str] = Field(sa_column=Column(ARRAY(String))) | ||
datasets_left: int | ||
total_datasets: int | ||
agents_left: int | ||
|
||
|
||
class Job(JobBase, table=True): | ||
"""Job object in the database. Internal ID is an implementation detail""" | ||
|
||
internal_id: Union[int, None] = Field(default=None, primary_key=True) | ||
|
||
|
||
class JobView(JobBase): | ||
"""Pydantic model used in the public API""" | ||
|
||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.