Skip to content

Commit

Permalink
Configurable sample config public image (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulineribeyre authored Mar 28, 2024
1 parent 4466544 commit 9131a97
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions doc/howto/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ An example manifest entry may look like
"lifecycle-pre-stop": ["su", "-c", "cd /data; for f in *; do fusermount -u $f; rm -rf $f; done", "-s", "/bin/sh", "jovyan"]
},
"nextflow-global": {
"sample-config-public-image": "",
"imagebuilder-reader-role-arn": ""
},
"containers": [
Expand Down Expand Up @@ -125,6 +126,7 @@ An example manifest entry may look like
* `command` a string array as the command to run in the container overriding the default.
* `lifecycle-pre-stop` a string array as the container prestop command.
* `nextflow-global` is for global configuration specific to Nextflow containers.
* `sample-config-public-image`: a publicly-accessible image that any user can pull to test Nextflow workflows. Will be mentioned in the auto-generated sample configuration and documentation when a user launches a Nextflow workspace.
* `imagebuilder-reader-role-arn`: see the [nextflow-global.imagebuilder-reader-role-arn section](/doc/explanation/nextflow.md#nextflow-globalimagebuilder-reader-role-arn) of the Nextflow workspaces documentation.
* `containers` is the list of workspaces available to be run by this instance of Hatchery. Each container must be a single image and expose a web server.
* `target-port` specifies the port that the container is exposing the webserver on.
Expand Down
1 change: 1 addition & 0 deletions hatchery/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (

// Global configuration shared by all Nextflow containers
type NextflowGlobalConfig struct {
SampleConfigPublicImage string `json:"sample-config-public-image"`
ImageBuilderReaderRoleArn string `json:"imagebuilder-reader-role-arn"`
}

Expand Down
2 changes: 1 addition & 1 deletion hatchery/hatchery.go
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ func getMountFileContents(fileId string, userName string) (string, error) {
}

if fileId == "sample-nextflow-config.txt" {
out, err := generateNextflowConfig(userName)
out, err := generateNextflowConfig(Config.Config.NextflowGlobalConfig, userName)
if err != nil {
Config.Logger.Printf("unable to generate Nextflow config: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion hatchery/hatchery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,7 @@ aws {
}
}`
originalGenerateNextflowConfig := generateNextflowConfig
generateNextflowConfig = func(userName string) (string, error) {
generateNextflowConfig = func(nextflowGlobalConfig NextflowGlobalConfig, userName string) (string, error) {
return fileContents, nil
}
defer func() {
Expand Down
5 changes: 3 additions & 2 deletions hatchery/nextflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -1608,7 +1608,7 @@ var stopSquidInstance = func(hostname string, userName string, ec2svc *ec2.EC2)
return nil
}

var generateNextflowConfig = func(userName string) (string, error) {
var generateNextflowConfig = func(nextflowGlobalConfig NextflowGlobalConfig, userName string) (string, error) {
sess := session.Must(session.NewSession(&aws.Config{
Region: aws.String("us-east-1"),
}))
Expand Down Expand Up @@ -1652,7 +1652,7 @@ var generateNextflowConfig = func(userName string) (string, error) {
process {
executor = 'awsbatch'
queue = '%s'
container = 'public.ecr.aws/l5b8a5z6/nextflow-approved/public:gen3-amazonlinux-base-AL2023fix'
container = '%s'
}
aws {
batch {
Expand All @@ -1662,6 +1662,7 @@ aws {
}
workDir = '%s'`,
batchJobQueueName,
nextflowGlobalConfig.SampleConfigPublicImage,
nextflowJobsRoleArn,
workDir,
)
Expand Down

0 comments on commit 9131a97

Please sign in to comment.