Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultShouldScheduleNextJobs ¶
DefaultShouldScheduleNextJobs is the default implementation of TextClassifier.ShouldScheduleNextJobs.
It always returns true and no error.
Types ¶
type ShouldScheduleNextJobsFn ¶
ShouldScheduleNextJobsFn is a function which returns a boolean flag that indicates whether a TextClassifier job should proceed scheduling the next configured jobs upon successful completion.
Arguments:
tx: the Gorm transaction instance created for the current job. It can be used for getting data from the DB if needed; otherwise it can be ignored. wa: the WebArticle that has been classified. wa.TextClasses contains the classification's results (depending on the implementation, it might be empty). This value MUST NOT be modified.
Returned values:
- If true is returned with no error, the configured config.TextClassifier.ProcessedWebArticleJobs will be scheduled.
- If false is returned with no error, no new jobs will be scheduled.
- If the returned error is not nil, the boolean value is ignored and the whole job will be aborted.
type TextClassifier ¶
type TextClassifier struct { basemodelworker.Worker // A custom function can be assigned for deciding whether to schedule or // not the configured next jobs upon completion // // The default value is DefaultShouldScheduleNextJobs. ShouldScheduleNextJobs ShouldScheduleNextJobsFn // contains filtered or unexported fields }
TextClassifier implements a Faktory worker for classifying existing WebArticles with a generic text classifier.
func New ¶
func New( conf config.TextClassifier, db *gorm.DB, classifierConn *grpc.ClientConn, fk *faktory_worker.Manager, ) *TextClassifier
New creates a new TextClassifier.
Click to show internal directories.
Click to hide internal directories.