INNER CODE UNIT · Python
DocumentProcessingJob
center-for-threat-informed-defense/tram · src/tram/models.py:78
class DocumentProcessingJob(models.Model):
"""Queue of document processing jobs"""
document = models.ForeignKey(Document, on_delete=models.CASCADE)
status = models.CharField(
max_length=255, default="queued", choices=JOB_STATUS_CHOICES
)
message = models.CharField(max_length=16384, default="")
created_by = models.ForeignKey(User, null=True, on_delete=models.SET_NULL)
created_on = models.DateTimeField(auto_now_add=True)
updated_on = models.DateTimeField(auto_now=True)
@classmethod
def create_from_file(cls, f, u):
"""
Creates a document processing job for the ML pipeline based on a file
submission by an authenticated user.