model

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 26, 2021 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JobSchema = `` /* 516-byte string literal not displayed */

	JobStatusSchema = `
		create table if not exists job_status
		(id integer primary key, status string)
	`
)
View Source
const (
	StatusPending  // 1
	StatusRunning  // 2
	StatusComplete // 3
	StatusError    // 4
)

Variables

This section is empty.

Functions

func CompleteJob

func CompleteJob(db *sqlx.DB, job *Job, statusID int) error

Complete Job

func LogJobMessage

func LogJobMessage(db *sqlx.DB, job *Job, task, message string, percent int) error

Log message for job

func NewDB

func NewDB(driver, dsn string) (*sqlx.DB, error)

func QueueJob

func QueueJob(db *sqlx.DB, job *Job) error

Queue a new DENSS Job

Types

type ExtraParams added in v0.0.2

type ExtraParams struct {
	// Symmetry
	Symmetry int64 `db:"-" json:"ncs" valid:"-" schema:"ncs"`

	// Symmetry Axis
	SymmetryAxis int64 `db:"-" json:"ncs_axis" valid:"-" schema:"ncs_axis"`

	// Symmetry Steps
	SymmetrySteps string `db:"-" json:"ncs_steps" valid:"-" schema:"ncs_steps"`

	// Fit experimental data
	Fit bool `db:"-" json:"fit" valid:"-" schema:"fit"`

	// Enantiomer
	Enantiomer bool `db:"-" json:"enantiomer" valid:"-" schema:"enantiomer"`

	// Mode
	Mode string `db:"-" json:"mode" valid:"-" schema:"mode"`

	// Units
	Units string `db:"-" json:"units" valid:"-" schema:"units"`

	// Method
	Method string `db:"-" json:"method" valid:"-" schema:"-"`
}

type Job

type Job struct {
	ExtraParams

	// Unique ID for the Job
	ID int64 `db:"id" json:"id" valid:"-" schema:"-"`

	// Email Address
	Email string `db:"email" json:"-" valid:"email" schema:"email"`

	// Unique Job token
	Token string `db:"token" json:"-" valid:"-" schema:"-"`

	// Job Status ID
	StatusID int64 `db:"status_id" json:"-" valid:"-" schema:"-"`

	// Job Status string
	Status string `db:"status" json:"status" valid:"-" schema:"-"`

	// Task Name
	Task string `db:"task" json:"task" valid:"-" schema:"-"`

	// Percent complete
	PercentComplete int64 `db:"percent_complete" json:"percent_complete" valid:"-" schema:"-"`

	// Log message for task
	LogMessage string `db:"log_message" json:"log_message" valid:"-" schema:"-"`

	// Job Name
	Name string `` /* 192-byte string literal not displayed */

	// File Type (dat | out)
	FileType string `db:"file_type" json:"-" valid:"-" schema:"-"`

	// Input data file (*.dat or GNOM *.out file)
	InputData []byte `db:"input_data" json:"-" valid:"-" schema:"-"`

	// Resulting density map in CCP4 format
	DensityMap []byte `db:"density_map" json:"-" valid:"-" schema:"-"`

	// Fourier SHell Correlation (FSC) Curve chart
	FSCChart []byte `db:"fsc_chart" json:"-" valid:"-" schema:"-"`

	// Summary stats chart
	SummaryChart []byte `db:"summary_chart" json:"-" valid:"-" schema:"-"`

	// A zip of the raw output from DENSS
	RawData []byte `db:"raw_data" json:"-" valid:"-" schema:"-"`

	// Maximum dimension of particle
	Dmax float64 `db:"dmax" json:"-" valid:"range(10.0|1000.0)~Dmax should be between 10 and 1000" schema:"dmax"`

	// Number of samples. This represents the size of the grid in each
	// dimension. The grid is 3D so NumSamples=31 would be 31 x 31 x 31. The
	// grid size will determine the speed of the calculation and memory used.
	// More samples means greater resolution. This is calculated by DENSS, it's
	// not given to DENSS but we want to control the speed of calcuation so we
	// use this parameter to determine the voxel size.
	NumSamples int64 `db:"num_samples" json:"-" valid:"range(2|500)~Number of samples should be between 2 and 500" schema:"-"`

	// Oversampling size
	Oversampling float64 `db:"oversampling" json:"-" valid:"range(2|50)~Oversampling should be between 2 and 50" schema:"-"`

	// Voxel Size
	VoxelSize float64 `db:"voxel_size" json:"-" valid:"range(1.0|100.0)~Voxel Size should be between 1 and 100" schema:"-"`

	// Number of electrons
	Electrons int64 `db:"electrons" json:"-" valid:"range(1|100000000)~Electrons should be between 1 and 1e8" schema:"electrons"`

	// Maximum number of steps
	MaxSteps int64 `db:"max_steps" json:"-" valid:"range(100|10000)~Max Steps should be between 100 and 10000" schema:"-"`

	// Maximum number of times to run DENSS
	MaxRuns int64 `db:"max_runs" json:"-" valid:"range(2|100)~Max Runs should be between 2 and 100" schema:"-"`

	// Params hack
	Params string `db:"params" json:"-" valid:"-" schema:"-"`

	// Time the job was submitted
	Submitted *time.Time `db:"submitted" json:"-" valid:"-" schema:"-"`

	// Time the job started running
	Started *time.Time `db:"started" json:"-" valid:"-" schema:"-"`

	// Time the job completed
	Completed *time.Time `db:"completed" json:"-" valid:"-" schema:"-"`

	// Current running/wait time for the job. Only used in json
	Time string `db:"-" json:"time" valid:"-" schema:"-"`
}

A DENSS Job

func FetchAllJobs added in v0.0.2

func FetchAllJobs(db *sqlx.DB, status, limit, offset int) ([]*Job, error)

Fetch all jobs by status

func FetchDensityMap

func FetchDensityMap(db *sqlx.DB, token string) (*Job, error)

Fetch job density map by token.

func FetchFSCChart

func FetchFSCChart(db *sqlx.DB, token string) (*Job, error)

Fetch job fsc chart by token.

func FetchJob

func FetchJob(db *sqlx.DB, token string) (*Job, error)

Fetch job by token. This is used for displaying the Job status in the web interface and no raw binary data is included

func FetchNextPending

func FetchNextPending(db *sqlx.DB) (*Job, error)

Fetch next job in pending status, update status to running and return job

func FetchRawData

func FetchRawData(db *sqlx.DB, token string) (*Job, error)

Fetch job raw data by token.

func FetchSummaryChart added in v0.0.2

func FetchSummaryChart(db *sqlx.DB, token string) (*Job, error)

Fetch job summary chart by token.

func (*Job) MarshallParams added in v0.0.2

func (j *Job) MarshallParams() error

func (*Job) RunTime added in v0.0.2

func (j *Job) RunTime() string

func (*Job) URL

func (j *Job) URL() string

func (*Job) UnmarshallParams added in v0.0.2

func (j *Job) UnmarshallParams() error

func (*Job) WaitTime added in v0.0.2

func (j *Job) WaitTime() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL