Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Funnel 0.11.1 release 🎉 #1074

Open
wants to merge 81 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
a890793
Upgrade kubernetes client library version to v0.28.4
KrKOo Dec 5, 2023
c011144
Upgrade golang version in Dockerfiles to 1.21.4
KrKOo Dec 5, 2023
2a104c8
Add build and dependency caching to Dockerfiles
KrKOo Dec 11, 2023
f675f0b
Add native kubernetes task execution support
KrKOo Dec 11, 2023
3d601a6
Remove useless methods from KubernetesCommand
KrKOo Dec 12, 2023
96a65a2
Dependabot update
lbeckman314 May 6, 2024
d5d3cf4
build(deps): bump braces and react-scripts in /webdash
dependabot[bot] Jun 15, 2024
a54b0d8
build(deps): bump the dependabot group across 1 directory with 21 upd…
dependabot[bot] Jun 19, 2024
c602078
Merge pull request #996 from ohsu-comp-bio/dependabot/go_modules/deve…
lbeckman314 Jun 20, 2024
4eae173
Merge branch 'develop' into dependabot/npm_and_yarn/webdash/multi-7ec…
lbeckman314 Jun 20, 2024
8f7cb16
Merge pull request #992 from ohsu-comp-bio/dependabot/npm_and_yarn/we…
lbeckman314 Jun 20, 2024
fbe2636
build(deps): bump ws from 6.2.2 to 6.2.3 in /webdash
dependabot[bot] Jun 20, 2024
254faea
Merge branch 'develop' into dependabot/npm_and_yarn/webdash/ws-6.2.3
lbeckman314 Jun 20, 2024
2f8363e
Merge pull request #995 from ohsu-comp-bio/dependabot/npm_and_yarn/we…
lbeckman314 Jun 20, 2024
139f0dd
build(deps): bump the dependabot group with 4 updates
dependabot[bot] Jun 20, 2024
589909b
Merge pull request #998 from ohsu-comp-bio/dependabot/go_modules/deve…
lbeckman314 Jun 20, 2024
73907f4
build(deps): bump the dependabot group across 1 directory with 15 upd…
dependabot[bot] Jul 24, 2024
7639f22
build(deps): bump ws from 6.2.2 to 6.2.3 in /webdash (#999)
dependabot[bot] Jul 24, 2024
2ea5610
Update unsupported backends response code (400) (#997)
lbeckman314 Jul 24, 2024
944937a
build(deps): bump the dependabot group with 3 updates (#1021)
dependabot[bot] Jul 26, 2024
d67a738
build(deps): bump actions/download-artifact in /.github/workflows (#1…
dependabot[bot] Sep 10, 2024
81270f9
build(deps): bump webpack and react-scripts in /webdash (#1042)
dependabot[bot] Sep 10, 2024
56141fc
build(deps): bump micromatch and react-scripts in /webdash (#1041)
dependabot[bot] Sep 10, 2024
b80292d
build(deps): bump the dependabot group across 1 directory with 19 upd…
dependabot[bot] Sep 10, 2024
1c08889
build(deps): bump github.com/docker/docker (#1028)
dependabot[bot] Sep 10, 2024
8cf42aa
build(deps): bump the dependabot group across 1 directory with 7 upda…
dependabot[bot] Sep 12, 2024
da9d083
Merge branch 'develop' into master
lbeckman314 Sep 12, 2024
e6877b2
Merge pull request #755 from KrKOo/master
lbeckman314 Sep 12, 2024
7233e29
build(deps): bump path-to-regexp and express in /webdash (#1051)
dependabot[bot] Sep 12, 2024
b52cba4
build(deps): bump body-parser and express in /webdash (#1053)
dependabot[bot] Sep 12, 2024
b276244
build(deps): bump the dependabot group across 1 directory with 13 upd…
dependabot[bot] Sep 19, 2024
b6cab03
Upgrade kubernetes client library version to v0.28.4
KrKOo Dec 5, 2023
9e89b41
Add native kubernetes task execution support
KrKOo Dec 11, 2023
2a5615a
Release/0.11.0 🎉 (#749)
lbeckman314 Apr 27, 2024
808fbe7
build(deps): bump braces and react-scripts in /webdash
dependabot[bot] Jun 15, 2024
fd8fbcb
Dependabot update
lbeckman314 May 6, 2024
e2dd423
build(deps): bump ws from 6.2.2 to 6.2.3 in /webdash (#999)
dependabot[bot] Jul 24, 2024
7ffa14e
build(deps): bump webpack and react-scripts in /webdash (#1042)
dependabot[bot] Sep 10, 2024
90fc47b
build(deps): bump micromatch and react-scripts in /webdash (#1041)
dependabot[bot] Sep 10, 2024
9e34947
build(deps): bump github.com/docker/docker (#1028)
dependabot[bot] Sep 10, 2024
00f6c43
build(deps): bump the dependabot group across 1 directory with 22 upd…
dependabot[bot] Sep 25, 2024
3928b53
build(deps): bump the dependabot group with 8 updates (#1066)
dependabot[bot] Sep 26, 2024
e6a029a
build(deps): bump the dependabot group with 2 updates (#1067)
dependabot[bot] Sep 30, 2024
e157bb8
build(deps): bump google.golang.org/grpc in the dependabot group (#1070)
dependabot[bot] Oct 1, 2024
8166db7
Add support for configurable containers engines (#963)
lbeckman314 Oct 3, 2024
ce59261
Feature/enable tags (#1073)
lbeckman314 Oct 3, 2024
1718725
build(deps): bump the dependabot group across 1 directory with 9 upda…
dependabot[bot] Oct 7, 2024
a3f0d2c
Merge branch 'master' into develop
lbeckman314 Oct 7, 2024
da420b4
Update file_mapper.go
lbeckman314 Oct 7, 2024
a2e09a8
Fix/k8s executor (#1078)
lbeckman314 Oct 10, 2024
91c4a4a
Fix Funnel worker k8s config example
lbeckman314 Oct 10, 2024
bdceade
Update K8s README and config files
lbeckman314 Oct 10, 2024
369eecb
Delete deployments/kubernetes/dind directory
lbeckman314 Oct 10, 2024
839b61a
Delete deployments/kubernetes/dind-rootless directory
lbeckman314 Oct 10, 2024
a70f0e9
Delete deployments/kubernetes/funnel-config.yaml
lbeckman314 Oct 10, 2024
9244418
Update README.md
lbeckman314 Oct 10, 2024
54c5ba6
Update README.md
lbeckman314 Oct 10, 2024
375d996
Update README.md
lbeckman314 Oct 10, 2024
79ecee3
Create funnel-worker-config.yml
lbeckman314 Oct 10, 2024
b9d254d
Delete deployments/kubernetes/svc.yaml
lbeckman314 Oct 10, 2024
0439fce
Update README.md
lbeckman314 Oct 10, 2024
5ad5631
Update README.md
lbeckman314 Oct 10, 2024
47e7dc2
Update README.md
lbeckman314 Oct 10, 2024
aa9886e
Update README.md
lbeckman314 Oct 10, 2024
f3b8225
Rename pvc.yaml to pvc.yml
lbeckman314 Oct 10, 2024
6288402
Update README.md
lbeckman314 Oct 10, 2024
69f8561
Update README.md
lbeckman314 Oct 10, 2024
7abf6e7
Rename pvc.yml to funnel-storage-pvc.yml
lbeckman314 Oct 10, 2024
2c61d4b
Update README.md
lbeckman314 Oct 10, 2024
e6e3f7d
Update README.md
lbeckman314 Oct 10, 2024
f3edfec
Update README.md
lbeckman314 Oct 10, 2024
3b2ecca
Update website with code block copy button and nord theme
lbeckman314 Oct 11, 2024
a520047
Disable code copy button on main page
lbeckman314 Oct 11, 2024
ac0b7cd
fix typo in `amazon_s3.go`
lbeckman314 Oct 11, 2024
3c2f623
Update README.md
lbeckman314 Oct 11, 2024
a6ff661
build(deps): bump the dependabot group across 1 directory with 2 upda…
dependabot[bot] Oct 12, 2024
4f7c758
Update README.md
lbeckman314 Oct 14, 2024
4f488dd
Add initial helm charts for k8s deployments (#1080)
lbeckman314 Oct 17, 2024
8ce2930
build(deps): bump the dependabot group across 1 directory with 2 upda…
dependabot[bot] Oct 17, 2024
2531a4b
Set Funnel K8s worker to always use 'development' tag
lbeckman314 Oct 22, 2024
5a8c6b8
Update Helm Charts with initial support for full config files (#1083)
lbeckman314 Oct 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ jobs:
key: ${{ runner.os }}-funnel-bin-${{ hashFiles('**/go.sum') }}-${{ github.ref }}
restore-keys: |
${{ runner.os }}-funnel-bin-${{ github.ref }}
${{ runner.os }}-funnel-bin-

- name: Build Funnel (if cache doesn't exist)
run: |
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/compliance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ jobs:
matrix:
version: [1.0.0, 1.1.0]
db: ["boltdb", "mongodb"]
compute: ["local", "kubernetes"]
# Temporary: Only test local compute backend until we bring up a K8s cluster in Github Actions
# compute: ["local", "kubernetes"]
compute: ["local"]
storage: ["local", "s3"]
needs: build
runs-on: ubuntu-latest
Expand Down Expand Up @@ -70,6 +72,11 @@ jobs:
cat `pwd`/tests/s3.config.yml >> config.yml
fi

if [ ${{ matrix.compute }} = "kubernetes" ]; then
kubectl apply -f tests/k8s
cat `pwd`/tests/k8s.config.yml >> config.yml
fi

chmod +x funnel
./funnel server run --config `pwd`/config.yml &> funnel.logs &

Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/hugo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ name: Deploy Hugo site to Pages
on:
# Runs on pushes targeting the default branch
push:
branches: ["master"]
branches:
- main
- master

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand Down Expand Up @@ -58,7 +60,12 @@ jobs:
--minify \
--baseURL "${{ steps.pages.outputs.base_url }}/" \
--source website \
--destination public
--destination docs

# Run pagefind to add search functionality
# Reference: https://pagefind.app/docs/
npx -y pagefind --site docs

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@ storage/_test_download
docker/funnel
deployments/kubernetes/**/funnel
deployments/kubernetes/**/*.json
funnel
dist/
.vscode
4 changes: 2 additions & 2 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ archives:
name_template: "{{.ProjectName}}-{{.Os}}-{{.Arch}}-{{.Version}}"

brews:
- tap:
- repository:
owner: ohsu-comp-bio
name: homebrew-formula
folder: Formula
directory: Formula
skip_upload: true
description: "distributed task execution toolkit"
homepage: "https://ohsu-comp-bio.github.io/funnel/"
Expand Down
10 changes: 7 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# build stage
FROM golang:1.21-alpine AS build-env
FROM golang:1.23-alpine AS build-env
RUN apk add make git bash build-base
ENV GOPATH=/go
ENV PATH="/go/bin:${PATH}"
ADD ./ /go/src/github.com/ohsu-comp-bio/funnel
RUN cd /go/src/github.com/ohsu-comp-bio/funnel && make build

WORKDIR /go/src/github.com/ohsu-comp-bio/funnel
COPY go.* .
RUN go mod download
COPY . .
RUN --mount=type=cache,target=/root/.cache/go-build make build

# final stage
FROM alpine
Expand Down
12 changes: 8 additions & 4 deletions Dockerfile.dind
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
# build stage
FROM golang:1.20-alpine AS build-env
FROM golang:1.23-alpine AS build-env
RUN apk add make git bash build-base
ENV GOPATH=/go
ENV PATH="/go/bin:${PATH}"
ADD ./ /go/src/github.com/ohsu-comp-bio/funnel
RUN cd /go/src/github.com/ohsu-comp-bio/funnel && make build

WORKDIR /go/src/github.com/ohsu-comp-bio/funnel
COPY go.* .
RUN go mod download
COPY . .
RUN --mount=type=cache,target=/root/.cache/go-build make build

# final stage
FROM docker:stable-dind
FROM docker:dind
WORKDIR /opt/funnel
VOLUME /opt/funnel/funnel-work-dir
EXPOSE 8000 9090
Expand Down
12 changes: 8 additions & 4 deletions Dockerfile.dind-rootless
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
# build stage
FROM golang:1.20-alpine AS build-env
FROM golang:1.23-alpine AS build-env
RUN apk add make git bash build-base
ENV GOPATH=/go
ENV PATH="/go/bin:${PATH}"
ADD ./ /go/src/github.com/ohsu-comp-bio/funnel
RUN cd /go/src/github.com/ohsu-comp-bio/funnel && make build

WORKDIR /go/src/github.com/ohsu-comp-bio/funnel
COPY go.* .
RUN go mod download
COPY . .
RUN --mount=type=cache,target=/root/.cache/go-build make build

# final stage
FROM docker:stable-dind-rootless
FROM docker:dind-rootless
WORKDIR /opt/funnel
VOLUME /opt/funnel/funnel-work-dir
EXPOSE 8000 9090
Expand Down
19 changes: 5 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ git_upstream := $(shell git remote get-url $(shell git config branch.$(shell git
export GIT_BRANCH = $(git_branch)
export GIT_UPSTREAM = $(git_upstream)

export FUNNEL_VERSION=0.11.0
export FUNNEL_VERSION=0.11.1-rc.5

# LAST_PR_NUMBER is used by the release notes builder to generate notes
# based on pull requests (PR) up until the last release.
Expand Down Expand Up @@ -226,15 +226,7 @@ snapshot: release-dep

# build a docker container locally
docker:
docker build -t ohsucompbio/funnel:latest ./

# build a docker container that supports docker-in-docker
docker-dind:
docker build -t ohsucompbio/funnel-dind:latest -f Dockerfile.dind .

# build a docker container that supports rootless docker-in-docker
docker-dind-rootless:
docker build -t ohsucompbio/funnel-dind-rootless:latest -f Dockerfile.dind-rootless .
docker build -t quay.io/ohsu-comp-bio/funnel:latest ./

# Create a release on Github using GoReleaser
release:
Expand Down Expand Up @@ -268,12 +260,11 @@ website:
@cp ./config/*.txt ./website/static/funnel-config-examples/
@cp ./config/default-config.yaml ./website/static/funnel-config-examples/
hugo --source ./website
npx -y pagefind --site docs

# Serve the Funnel website on localhost:1313
website-dev:
@cp ./config/*.txt ./website/static/funnel-config-examples/
@cp ./config/default-config.yaml ./website/static/funnel-config-examples/
hugo --source ./website -w server
website-dev: website
hugo --source ./website --watch server

# Remove build/development files.
clean:
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Godoc](https://img.shields.io/badge/godoc-ref-blue.svg)](http://godoc.org/github.com/ohsu-comp-bio/funnel)


Funnel
======

https://ohsu-comp-bio.github.io/funnel/
<a title="Funnel Homepage" href="https://ohsu-comp-bio.github.io/funnel">
<img title="Funnel Logo" src="https://github.com/user-attachments/assets/f51cf06b-d802-4e20-bde1-bcd1fc5657e6" />
</a>

Funnel is a toolkit for distributed, batch task execution, including a server, worker, and a set of compute, storage, and database backends. Given a task description, Funnel will find a worker to execute the task, download inputs, run a series of (Docker) containers, upload outputs, capture logs, and track the whole process.

Funnel is an implementation of the [GA4GH Task Execution Schemas](https://github.com/ga4gh/task-execution-schemas), an effort to standardize the APIs used for task execution across many platforms.

Funnel provides an API server, multiple storage backends (local FS, S3, Google Bucket, etc.), multiple compute backends (local, HTCondor, Google Cloud, etc.), and a web dashboard.

https://ohsu-comp-bio.github.io/funnel/
2 changes: 1 addition & 1 deletion cmd/aws/batch/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func DefaultConfig() Config {
},
JobDef: JobDefinitionConfig{
Name: "funnel-job-def",
Image: "docker.io/ohsucompbio/funnel:latest",
Image: "quay.io/ohsu-comp-bio/funnel:latest",
VCPUs: 1,
MemoryMiB: 128,
},
Expand Down
4 changes: 2 additions & 2 deletions cmd/node/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ func Run(ctx context.Context, conf config.Config, log *logger.Logger) error {
return err
}

runctx, cancel := context.WithCancel(context.Background())
runctx = util.SignalContext(ctx, time.Nanosecond, syscall.SIGINT, syscall.SIGTERM)
_, cancel := context.WithCancel(context.Background())
runctx := util.SignalContext(ctx, time.Nanosecond, syscall.SIGINT, syscall.SIGTERM)
defer cancel()

hupsig := make(chan os.Signal, 1)
Expand Down
7 changes: 6 additions & 1 deletion cmd/server/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,11 @@ func NewServer(ctx context.Context, conf config.Config, log *logger.Logger) (*Se
case strings.ToLower(conf.Database):
continue
case "log":
continue
if conf.Compute == "slurm" {
writer = &events.Logger{Log: log}
} else {
continue
}
case "boltdb":
writer, err = boltdb.NewBoltDB(conf.BoltDB)
case "badger":
Expand Down Expand Up @@ -271,6 +275,7 @@ func NewServer(ctx context.Context, conf config.Config, log *logger.Logger) (*Se
Compute: compute,
Read: reader,
Log: log,
Config: conf,
},
Events: &events.Service{Writer: writer},
Nodes: nodes,
Expand Down
4 changes: 4 additions & 0 deletions cmd/util/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ func workerFlags(flagConf *config.Config) *pflag.FlagSet {
f.Var(&flagConf.Worker.LogUpdateRate, "Worker.LogUpdateRate", "How often to send stdout/stderr log updates")
f.Var(&flagConf.Worker.PollingRate, "Worker.PollingRate", "How often to poll for cancel signals")
f.StringVar(&flagConf.Worker.WorkDir, "Worker.WorkDir", flagConf.Worker.WorkDir, "Working directory")
f.StringVar(&flagConf.Worker.ScratchPath, "Worker.ScratchPath", flagConf.Worker.ScratchPath, "Scratch directory")
f.BoolVar(&flagConf.Worker.LeaveWorkDir, "Worker.LeaveWorkDir", flagConf.Worker.LeaveWorkDir, "Leave working directory after execution")
f.StringVar(&flagConf.Worker.DriverCommand, "Worker.DriverCommand", flagConf.Worker.DriverCommand, "Overrides the default command used to run containers.")

return f
}
Expand Down Expand Up @@ -225,6 +227,8 @@ func computeFlags(flagConf *config.Config) *pflag.FlagSet {
f.Var(&flagConf.Scheduler.NodeDeadTimeout, "Scheduler.NodeDeadTimeout", "How long to wait before deleting a dead node from the DB")

// Kubernetes
f.StringVar(&flagConf.Kubernetes.Executor, "Kubernetes.Executor", flagConf.Kubernetes.Executor, "Executor to use for executing tasks (docker or kubernetes)")
f.StringVar(&flagConf.Kubernetes.ExecutorTemplateFile, "Kubernetes.ExecutorTemplateFile", flagConf.Kubernetes.ExecutorTemplateFile, "Path to executor job template file")
f.StringVar(&flagConf.Kubernetes.TemplateFile, "Kubernetes.TemplateFile", flagConf.Kubernetes.TemplateFile, "Path to job template file")
f.StringVar(&flagConf.Kubernetes.Namespace, "Kubernetes.Namespace", flagConf.Kubernetes.Namespace, "Namespace to spawn jobs within")
f.StringVar(&flagConf.Kubernetes.ConfigFile, "Kubernetes.ConfigFile", flagConf.Kubernetes.ConfigFile, "Path to kubernetes config file")
Expand Down
22 changes: 22 additions & 0 deletions cmd/worker/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package worker
import (
"context"
"fmt"
"os"
"strings"

"github.com/ohsu-comp-bio/funnel/config"
Expand Down Expand Up @@ -70,7 +71,28 @@ func NewWorker(ctx context.Context, conf config.Config, log *logger.Logger, opts
}
store.AttachLogger(log)

if conf.Kubernetes.ExecutorTemplateFile != "" {
content, err := os.ReadFile(conf.Kubernetes.ExecutorTemplateFile)
if err != nil {
return nil, fmt.Errorf("reading template: %v", err)
}
conf.Kubernetes.ExecutorTemplate = string(content)
}

// The executor always defaults to docker, unless explicitly set to kubernetes.
var executor = worker.Executor{
Backend: "docker",
}

if conf.Kubernetes.Executor == "kubernetes" {
executor.Backend = "kubernetes"
executor.Template = conf.Kubernetes.ExecutorTemplate
executor.Namespace = conf.Kubernetes.Namespace
executor.ServiceAccount = conf.Kubernetes.ServiceAccount
}

return &worker.DefaultWorker{
Executor: executor,
Conf: conf.Worker,
Store: store,
TaskReader: reader,
Expand Down
21 changes: 15 additions & 6 deletions compute/hpc_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ type HPCBackend struct {
func (b *HPCBackend) WriteEvent(ctx context.Context, ev *events.Event) error {
switch ev.Type {
case events.Type_TASK_CREATED:
return b.Submit(ev.GetTask())
return b.Submit(ctx, ev.GetTask())

case events.Type_TASK_STATE:
if ev.GetState() == tes.State_CANCELED {
Expand All @@ -61,10 +61,8 @@ func (b *HPCBackend) WriteEvent(ctx context.Context, ev *events.Event) error {
func (b *HPCBackend) Close() {}

// Submit submits a task via "qsub", "condor_submit", "sbatch", etc.
func (b *HPCBackend) Submit(task *tes.Task) error {
ctx := context.Background()

submitPath, err := b.setupTemplatedHPCSubmit(task)
func (b *HPCBackend) Submit(ctx context.Context, task *tes.Task) error {
submitPath, err := b.setupTemplatedHPCSubmit(ctx, task)
if err != nil {
return err
}
Expand Down Expand Up @@ -229,7 +227,7 @@ ReconcileLoop:
// setupTemplatedHPCSubmit sets up a task submission in a HPC environment with
// a shared file system. It generates a submission file based on a template for
// schedulers such as SLURM, HTCondor, SGE, PBS/Torque, etc.
func (b *HPCBackend) setupTemplatedHPCSubmit(task *tes.Task) (string, error) {
func (b *HPCBackend) setupTemplatedHPCSubmit(ctx context.Context, task *tes.Task) (string, error) {
var err error

// TODO document that these working dirs need manual cleanup
Expand Down Expand Up @@ -264,13 +262,24 @@ func (b *HPCBackend) setupTemplatedHPCSubmit(task *tes.Task) (string, error) {
zone = zones[0]
}

var args string
if ctx.Value("Config") != nil {
conf := ctx.Value("Config").(config.Config)
configFile := filepath.Join(workdir, "config.yaml")
err = config.ToYamlFile(conf, configFile)
if err != nil {
return "", err
}
args = fmt.Sprintf("--config %v", configFile)
}
err = submitTpl.Execute(f, map[string]interface{}{
"TaskId": task.Id,
"WorkDir": workdir,
"Cpus": res.GetCpuCores(),
"RamGb": res.GetRamGb(),
"DiskGb": res.GetDiskGb(),
"Zone": zone,
"Args": args,
})
if err != nil {
return "", err
Expand Down
3 changes: 2 additions & 1 deletion compute/hpc_backend_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package compute

import (
"context"
"fmt"
"os"
"testing"
Expand Down Expand Up @@ -58,7 +59,7 @@ funnel worker run --taskID {{.TaskId}}
Conf: conf,
}

sf, err := b.setupTemplatedHPCSubmit(task)
sf, err := b.setupTemplatedHPCSubmit(context.Background(), task)
if err != nil {
t.Fatal(err)
}
Expand Down
Loading
Loading