Skip to content

Commit

Permalink
activated replicon handling and prodigal tf
Browse files Browse the repository at this point in the history
  • Loading branch information
MariusDieckmann committed May 14, 2021
1 parent 10bac42 commit c19b197
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 119 deletions.
2 changes: 1 addition & 1 deletion .kube/dev-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ spec:
secretKeyRef:
key: Token
name: authhandler
image: harbor.computational.bio.uni-giessen.de/bakta/bakta-web-backend:0.2.7
image: harbor.computational.bio.uni-giessen.de/bakta/bakta-web-backend:0.2.8
imagePullPolicy: Always
name: baktabackend
ports:
Expand Down
9 changes: 7 additions & 2 deletions config/local-config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
Objectstorage:
S3:
Bucket: baktadata
UserBucket: baktauserdata
DBBucket: baktadbs
BaseKey: data/dev
Database:
Backend: SQLite
SQLite:
Path: /tmp
K8sNamespace: "bakta-dev"
K8sNamespace: "bakta-dev"
UpdateService:
Name: baktawebbackend
Port: "8081"
Testing: true
3 changes: 2 additions & 1 deletion database/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ func (handler *Handler) CreateJob() (*Job, string, error) {
//UpdateK8s Updates a job with its k8s id
func (handler *Handler) UpdateK8s(id string, k8s string, conf string) error {
job := Job{
JobID: id,
JobID: id,
ConfString: conf,
}

getDataResult := handler.DB.First(&job)
Expand Down
2 changes: 1 addition & 1 deletion endpoints/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (apiHandler *BaktaJobAPI) StartJob(ctx context.Context, request *api.StartJ
return nil, err
}

k8sJob, err := apiHandler.scheduler.StartJob(request.Job.GetJobID(), request.GetConfig())
k8sJob, err := apiHandler.scheduler.StartJob(request.Job.GetJobID(), request.GetConfig(), request.GetJobConfigString())
if err != nil {
log.Println(err.Error())
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/ag-computational-bio/bakta-web-backend
go 1.16

require (
github.com/ag-computational-bio/bakta-web-api-go v0.0.0-20210511164724-debd1af1ed2a
github.com/ag-computational-bio/bakta-web-api-go v0.0.0-20210512084259-ad07339c1e85
github.com/aws/aws-sdk-go-v2 v1.4.0
github.com/aws/aws-sdk-go-v2/config v1.1.7
github.com/aws/aws-sdk-go-v2/service/s3 v1.6.0
Expand Down Expand Up @@ -31,7 +31,7 @@ require (
golang.org/x/term v0.0.0-20210503060354-a79de5458b56 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20210510173355-fb37daa5cd7a // indirect
google.golang.org/grpc v1.37.0
google.golang.org/grpc v1.37.1
google.golang.org/protobuf v1.26.0
gopkg.in/ini.v1 v1.62.0 // indirect
gorm.io/driver/postgres v1.1.0
Expand Down
116 changes: 11 additions & 105 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

var opts struct {
ConfigFile string `short:"c" long:"configfile" description:"File of the config file" default:"./config/config.yaml"`
ConfigFile string `short:"c" long:"configfile" description:"File of the config file" default:"./config/local-config.yaml"`
}

//Version Version tag
Expand Down
2 changes: 1 addition & 1 deletion monitor/SimpleMonitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (monitor *SimpleMonitor) GetJobStatus(jobID string) (JobStatus, error) {
if job.Status.Active >= 1 {
jobStatus.Status = api.JobStatusEnum_RUNNING
} else if job.Status.Succeeded >= 1 && job.Status.Active == 0 {
jobStatus.Status = api.JobStatusEnum_SUCCESFULL
jobStatus.Status = api.JobStatusEnum_SUCCESSFULL
} else if job.Status.Failed >= 1 && job.Status.Active == 0 {
jobStatus.Status = api.JobStatusEnum_ERROR
} else {
Expand Down
1 change: 1 addition & 0 deletions objectStorage/S3ObjectStorageHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type UploadLinks struct {
GBFF string `bakta:"gbff"`
FNA string `bakta:"fna"`
FAA string `bakta:"faa"`
JSON string `bakta:"json"`
TSVHypothetical string `bakta:"hypotheticals.tsv"`
FAAHypothetical string `bakta:"hypotheticals.faa"`
}
Expand Down
13 changes: 12 additions & 1 deletion scheduler/JobConfigurator.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,17 @@ import (
//The job has to be provided along with two bools that indicate if a prodigal training file and/or a replicon file are present
func createDownloadConf(job *database.Job, prodigaltf bool, replicontsv bool) (string, error) {
keyString := job.FastaKey
bucketString := job.DataBucket
if prodigaltf {
keyString = fmt.Sprintf(keyString+",%v", job.ProdigalKey)
bucketString = fmt.Sprintf(bucketString+",%v", job.DataBucket)
}
if replicontsv {
keyString = fmt.Sprintf(keyString+",%v", job.RepliconKey)
bucketString = fmt.Sprintf(bucketString+",%v", job.DataBucket)
}

confString := fmt.Sprintf("download -b %v -k %v -d /data -e s3.computational.bio.uni-giessen.de", job.DataBucket, keyString)
confString := fmt.Sprintf("download -b %v -k %v -d /data -e s3.computational.bio.uni-giessen.de", bucketString, keyString)

return confString, nil
}
Expand All @@ -43,6 +46,14 @@ func createBaktaConf(job *database.Job, conf *api.JobConfig, rawConfString strin
confStringElements = append(confStringElements, "--prefix result")
confStringElements = append(confStringElements, "-o /output")

if conf.HasProdigal {
confStringElements = append(confStringElements, "--prodigal-tf prodigaltraining.protf")
}

if conf.HasReplicons {
confStringElements = append(confStringElements, "--replicons replicons.tsv")
}

if viper.IsSet("Testing") || viper.IsSet("Debug") {
confStringElements = append(confStringElements, "--db /db/db-mock")
} else {
Expand Down
6 changes: 3 additions & 3 deletions scheduler/SimpleScheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,20 @@ func InitSimpleScheduler(dbHandler *database.Handler) (*SimpleScheduler, error)
}

//StartJob Starts a bakta job on Kubernetes
func (scheduler *SimpleScheduler) StartJob(jobID string, jobConfig *api.JobConfig) (*batchv1.Job, error) {
func (scheduler *SimpleScheduler) StartJob(jobID string, jobConfig *api.JobConfig, baktaConfString string) (*batchv1.Job, error) {
job, err := scheduler.databaseHandler.GetJob(jobID)
if err != nil {
log.Println(err.Error())
return nil, err
}

downloadConf, err := createDownloadConf(job, false, false)
downloadConf, err := createDownloadConf(job, jobConfig.HasProdigal, jobConfig.HasReplicons)
if err != nil {
log.Println(err.Error())
return nil, err
}

baktaConf, err := createBaktaConf(job, jobConfig, job.ConfString)
baktaConf, err := createBaktaConf(job, jobConfig, baktaConfString)
if err != nil {
log.Println(err.Error())
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion scheduler/startJob.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func createBaseJobConf(
},
},
},
BackoffLimit: int32Link(4),
BackoffLimit: int32Link(1),
},
}

Expand Down

0 comments on commit c19b197

Please sign in to comment.