Documentation
¶
Index ¶
- Constants
- func AddCloudWatchMetrics(syncGwAdminUrl string) error
- func GetDbConnection(syncGatewayUrl string) (db couch.Database, err error)
- type Attachments
- type ChangesFeedFollower
- type DeepStyleJob
- type Document
- type JobDocument
- func (doc *JobDocument) AddAttachment(attachmentName, filepath string) (err error)
- func (doc JobDocument) IsProcessingFailed() bool
- func (doc JobDocument) IsProcessingSuccessful() bool
- func (doc JobDocument) IsReadyToProcess() bool
- func (doc *JobDocument) RefreshFromDB() error
- func (doc *JobDocument) RetrieveAttachment(attachmentName string) (io.Reader, error)
- func (doc *JobDocument) SetConfiguration(config configuration)
- func (doc *JobDocument) SetErrorMessage(errorMessage error) (updated bool, err error)
- func (doc *JobDocument) SetStdOutAndErr(stdOutAndErr string) (updated bool, err error)
- func (doc *JobDocument) UpdateState(newState string) (updated bool, err error)
- type TrackedDeepStyleJob
- type TypedDocument
- type ViewParams
Constants ¶
View Source
const ( StateNotReadyToProcess = "NOT_READY_TO_PROCESS" // no attachments yet StateReadyToProcess = "READY_TO_PROCESS" // attachments added StateBeingProcessed = "BEING_PROCESSED" // worker running StateProcessingSuccessful = "PROCESSING_SUCCESSFUL" // worker done StateProcessingFailed = "PROCESSING_FAILED" // processing failed )
Job States
View Source
const ( SourceImageAttachment = "source_image" StyleImageAttachment = "style_image" ResultImageAttachment = "result_image" )
View Source
const ( DesignDocName = "unprocessed_jobs" ViewName = "unprocessed_jobs" )
View Source
const (
Job = "job"
)
Doc types
Variables ¶
This section is empty.
Functions ¶
func AddCloudWatchMetrics ¶
func GetDbConnection ¶
Types ¶
type Attachments ¶
type Attachments map[string]interface{}
type ChangesFeedFollower ¶
type ChangesFeedFollower struct { Database couch.Database UniqushURL string ProcessJobs bool // Run NeuralStyle (typically only on AWS+GPU) SendNotifications bool // Send push notifications when jobs done StartingSince string }
func NewChangesFeedFollower ¶
func NewChangesFeedFollower(startingSince, syncGatewayUrl string) (*ChangesFeedFollower, error)
func (ChangesFeedFollower) Follow ¶
func (f ChangesFeedFollower) Follow()
type DeepStyleJob ¶
type DeepStyleJob struct {
// contains filtered or unexported fields
}
func NewDeepStyleJob ¶
func NewDeepStyleJob(jobDoc JobDocument, config configuration) *DeepStyleJob
func (DeepStyleJob) DownloadAttachments ¶
func (d DeepStyleJob) DownloadAttachments() (err error, sourceImagePath, styleImagePath string)
func (DeepStyleJob) Execute ¶
func (d DeepStyleJob) Execute() (err error, outputFilePath, stdOutAndErr string)
type JobDocument ¶
type JobDocument struct { TypedDocument Attachments Attachments `json:"_attachments"` State string `json:"state"` CreatedAt string `json:"created_at"` Owner string `json:"owner"` OwnerDeviceToken string `json:"owner_devicetoken"` ErrorMessage string `json:"error_message"` StdOutAndErr string `json:"std_out_and_err"` // contains filtered or unexported fields }
func NewJobDocument ¶
func NewJobDocument(documentId string, config configuration) (jobDocument *JobDocument, err error)
func (*JobDocument) AddAttachment ¶
func (doc *JobDocument) AddAttachment(attachmentName, filepath string) (err error)
func (JobDocument) IsProcessingFailed ¶
func (doc JobDocument) IsProcessingFailed() bool
func (JobDocument) IsProcessingSuccessful ¶
func (doc JobDocument) IsProcessingSuccessful() bool
func (JobDocument) IsReadyToProcess ¶
func (doc JobDocument) IsReadyToProcess() bool
func (*JobDocument) RefreshFromDB ¶
func (doc *JobDocument) RefreshFromDB() error
func (*JobDocument) RetrieveAttachment ¶
func (doc *JobDocument) RetrieveAttachment(attachmentName string) (io.Reader, error)
func (*JobDocument) SetConfiguration ¶
func (doc *JobDocument) SetConfiguration(config configuration)
func (*JobDocument) SetErrorMessage ¶
func (doc *JobDocument) SetErrorMessage(errorMessage error) (updated bool, err error)
func (*JobDocument) SetStdOutAndErr ¶
func (doc *JobDocument) SetStdOutAndErr(stdOutAndErr string) (updated bool, err error)
func (*JobDocument) UpdateState ¶
func (doc *JobDocument) UpdateState(newState string) (updated bool, err error)
type TrackedDeepStyleJob ¶
type TrackedDeepStyleJob struct {
// contains filtered or unexported fields
}
Adds a time when we first saw this job in it's current state so that we can detect "stuck" jobs that never get processed.
type TypedDocument ¶
func (TypedDocument) IsJob ¶
func (doc TypedDocument) IsJob() bool
Click to show internal directories.
Click to hide internal directories.