Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
35 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
""" Core definition of a Task Document which represents a calculation from some program""" | ||
from datetime import datetime | ||
from typing import ClassVar, List | ||
|
||
from pydantic import BaseModel, Field | ||
|
||
from emmet.core.mpid import MPID | ||
|
||
|
||
class TaskDocument(BaseModel): | ||
""" | ||
Definition of Task Document | ||
""" | ||
|
||
calc_code: ClassVar[str] = Field( | ||
..., description="The calculation code used to compute this task" | ||
) | ||
version: str = Field(..., description="The version of the calculation code") | ||
dir_name: str = Field(None, description="The directory for this task") | ||
task_id: MPID = Field(None, description="the Task ID For this document") | ||
|
||
completed: bool = Field(False, description="Whether this calcuation completed") | ||
completed_at: datetime = Field( | ||
None, description="Timestamp for when this task was completed" | ||
) | ||
last_updated: datetime = Field( | ||
default_factory=datetime.utcnow, | ||
description="Timestamp for this task document was last updateed", | ||
) | ||
|
||
tags: List[str] = Field([], description="Metadata tags for this task document") | ||
|
||
warnings: List[str] = Field( | ||
None, description="Any warnings related to this property" | ||
) |