snakemake-executor-plugin-aws-basic-batch 0.1.0__tar.gz → 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- snakemake_executor_plugin_aws_basic_batch-0.2.0/.github/workflows/docker.yml +48 -0
- {snakemake_executor_plugin_aws_basic_batch-0.1.0 → snakemake_executor_plugin_aws_basic_batch-0.2.0}/.gitignore +1 -0
- {snakemake_executor_plugin_aws_basic_batch-0.1.0 → snakemake_executor_plugin_aws_basic_batch-0.2.0}/PKG-INFO +1 -1
- {snakemake_executor_plugin_aws_basic_batch-0.1.0 → snakemake_executor_plugin_aws_basic_batch-0.2.0}/README.md +24 -0
- snakemake_executor_plugin_aws_basic_batch-0.2.0/examples/simple-workflow/.dockerignore +5 -0
- snakemake_executor_plugin_aws_basic_batch-0.2.0/examples/simple-workflow/Dockerfile +56 -0
- {snakemake_executor_plugin_aws_basic_batch-0.1.0 → snakemake_executor_plugin_aws_basic_batch-0.2.0}/examples/simple-workflow/README.md +19 -30
- {snakemake_executor_plugin_aws_basic_batch-0.1.0 → snakemake_executor_plugin_aws_basic_batch-0.2.0}/examples/simple-workflow/justfile +76 -65
- snakemake_executor_plugin_aws_basic_batch-0.2.0/examples/simple-workflow/uv.lock +1076 -0
- snakemake_executor_plugin_aws_basic_batch-0.2.0/examples/terraform/README.md +139 -0
- {snakemake_executor_plugin_aws_basic_batch-0.1.0/examples/terraform/coordinator → snakemake_executor_plugin_aws_basic_batch-0.2.0/examples/terraform}/main.tf +359 -79
- snakemake_executor_plugin_aws_basic_batch-0.2.0/examples/terraform/terraform.tfvars.example +82 -0
- snakemake_executor_plugin_aws_basic_batch-0.2.0/justfile +44 -0
- {snakemake_executor_plugin_aws_basic_batch-0.1.0 → snakemake_executor_plugin_aws_basic_batch-0.2.0}/pyproject.toml +1 -1
- {snakemake_executor_plugin_aws_basic_batch-0.1.0 → snakemake_executor_plugin_aws_basic_batch-0.2.0}/src/snakemake_executor_plugin_aws_basic_batch/__init__.py +81 -13
- snakemake_executor_plugin_aws_basic_batch-0.2.0/tests/test_job_resources.py +138 -0
- {snakemake_executor_plugin_aws_basic_batch-0.1.0 → snakemake_executor_plugin_aws_basic_batch-0.2.0}/uv.lock +1 -1
- snakemake_executor_plugin_aws_basic_batch-0.1.0/examples/simple-workflow/.dockerignore +0 -2
- snakemake_executor_plugin_aws_basic_batch-0.1.0/examples/simple-workflow/Dockerfile +0 -7
- snakemake_executor_plugin_aws_basic_batch-0.1.0/examples/terraform/README.md +0 -144
- snakemake_executor_plugin_aws_basic_batch-0.1.0/examples/terraform/coordinator/.terraform.lock.hcl +0 -45
- snakemake_executor_plugin_aws_basic_batch-0.1.0/examples/terraform/coordinator/terraform.tfvars.example +0 -40
- snakemake_executor_plugin_aws_basic_batch-0.1.0/examples/terraform/simple-workflow/main.tf +0 -287
- snakemake_executor_plugin_aws_basic_batch-0.1.0/examples/terraform/simple-workflow/terraform.tfvars.example +0 -24
- snakemake_executor_plugin_aws_basic_batch-0.1.0/justfile +0 -47
- {snakemake_executor_plugin_aws_basic_batch-0.1.0 → snakemake_executor_plugin_aws_basic_batch-0.2.0}/.dockerignore +0 -0
- {snakemake_executor_plugin_aws_basic_batch-0.1.0 → snakemake_executor_plugin_aws_basic_batch-0.2.0}/.gitattributes +0 -0
- {snakemake_executor_plugin_aws_basic_batch-0.1.0 → snakemake_executor_plugin_aws_basic_batch-0.2.0}/.github/workflows/ci.yml +0 -0
- {snakemake_executor_plugin_aws_basic_batch-0.1.0 → snakemake_executor_plugin_aws_basic_batch-0.2.0}/.github/workflows/conventional-prs.yml +0 -0
- {snakemake_executor_plugin_aws_basic_batch-0.1.0 → snakemake_executor_plugin_aws_basic_batch-0.2.0}/.github/workflows/publish.yml +0 -0
- {snakemake_executor_plugin_aws_basic_batch-0.1.0 → snakemake_executor_plugin_aws_basic_batch-0.2.0}/Dockerfile +0 -0
- {snakemake_executor_plugin_aws_basic_batch-0.1.0 → snakemake_executor_plugin_aws_basic_batch-0.2.0}/LICENSE +0 -0
- {snakemake_executor_plugin_aws_basic_batch-0.1.0 → snakemake_executor_plugin_aws_basic_batch-0.2.0}/examples/simple-workflow/Snakefile +0 -0
- {snakemake_executor_plugin_aws_basic_batch-0.1.0 → snakemake_executor_plugin_aws_basic_batch-0.2.0}/examples/simple-workflow/pyproject.toml +0 -0
- {snakemake_executor_plugin_aws_basic_batch-0.1.0 → snakemake_executor_plugin_aws_basic_batch-0.2.0}/src/snakemake_executor_plugin_aws_basic_batch/batch_client.py +0 -0
- {snakemake_executor_plugin_aws_basic_batch-0.1.0 → snakemake_executor_plugin_aws_basic_batch-0.2.0}/tests/test_plugin.py +0 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
name: Publish to GHCR
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
push:
|
|
6
|
+
tags:
|
|
7
|
+
- 'v*'
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
docker:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
packages: write
|
|
15
|
+
steps:
|
|
16
|
+
- name: Check out the code
|
|
17
|
+
uses: actions/checkout@v5
|
|
18
|
+
|
|
19
|
+
- name: Set up Docker Buildx
|
|
20
|
+
uses: docker/setup-buildx-action@v3
|
|
21
|
+
|
|
22
|
+
- name: Extract metadata for Docker
|
|
23
|
+
id: meta
|
|
24
|
+
uses: docker/metadata-action@v5
|
|
25
|
+
with:
|
|
26
|
+
images: ghcr.io/${{ github.repository }}
|
|
27
|
+
tags: |
|
|
28
|
+
type=semver,pattern={{version}}
|
|
29
|
+
type=semver,pattern={{major}}.{{minor}}
|
|
30
|
+
type=semver,pattern={{major}}
|
|
31
|
+
type=raw,value=latest,enable={{is_default_branch}}
|
|
32
|
+
|
|
33
|
+
- name: Log in to GHCR
|
|
34
|
+
uses: docker/login-action@v3
|
|
35
|
+
with:
|
|
36
|
+
registry: ghcr.io
|
|
37
|
+
username: ${{ github.actor }}
|
|
38
|
+
password: ${{ secrets.GITHUB_TOKEN }}
|
|
39
|
+
|
|
40
|
+
- name: Build and push
|
|
41
|
+
uses: docker/build-push-action@v6
|
|
42
|
+
with:
|
|
43
|
+
context: .
|
|
44
|
+
push: true
|
|
45
|
+
tags: ${{ steps.meta.outputs.tags }}
|
|
46
|
+
labels: ${{ steps.meta.outputs.labels }}
|
|
47
|
+
cache-from: type=gha
|
|
48
|
+
cache-to: type=gha,mode=max
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: snakemake-executor-plugin-aws-basic-batch
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Project-URL: Repository, https://github.com/radusuciu/snakemake-executor-plugin-aws-basic-batch
|
|
5
5
|
Author-email: Radu Suciu <radusuciu@gmail.com>
|
|
6
6
|
License-File: LICENSE
|
|
@@ -31,6 +31,30 @@ Optional coordinator-specific settings:
|
|
|
31
31
|
- `--aws-basic-batch-coordinator-queue` - Job queue for the coordinator (defaults to main queue)
|
|
32
32
|
- `--aws-basic-batch-coordinator-job-definition` - Job definition for the coordinator (defaults to main job definition)
|
|
33
33
|
|
|
34
|
+
## Per-Job Resource Customization
|
|
35
|
+
|
|
36
|
+
Override CPU, memory, queue, or job definition on a per-rule basis using Snakemake's resource system:
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
rule compute_heavy:
|
|
40
|
+
output: "result.txt"
|
|
41
|
+
resources:
|
|
42
|
+
aws_batch_vcpu=4,
|
|
43
|
+
aws_batch_mem_mb=8192,
|
|
44
|
+
aws_batch_job_queue="high-memory-queue"
|
|
45
|
+
shell: "python compute.py > {output}"
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
| Resource | Description | Default |
|
|
49
|
+
|----------|-------------|---------|
|
|
50
|
+
| `aws_batch_vcpu` | Number of vCPUs | 1 |
|
|
51
|
+
| `aws_batch_mem_mb` | Memory in MiB | 1024 |
|
|
52
|
+
| `aws_batch_job_queue` | Job queue ARN/name | `--aws-basic-batch-job-queue` |
|
|
53
|
+
| `aws_batch_job_definition` | Job definition ARN/name | `--aws-basic-batch-job-definition` |
|
|
54
|
+
| `aws_batch_task_timeout` | Job timeout in seconds (min: 60) | `--aws-basic-batch-task-timeout` |
|
|
55
|
+
|
|
56
|
+
These values override the base job definition's resource configuration at submission time via AWS Batch's `containerOverrides.resourceRequirements`.
|
|
57
|
+
|
|
34
58
|
## Requirements
|
|
35
59
|
|
|
36
60
|
- Workflow and dependencies must be included in the container image
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# syntax=docker/dockerfile:1
|
|
2
|
+
|
|
3
|
+
# Example workflow image using multi-stage build with uv
|
|
4
|
+
# This serves as a template for building your own workflow images
|
|
5
|
+
|
|
6
|
+
ARG PYTHON_VERSION=3.13
|
|
7
|
+
ARG COORDINATOR_IMAGE=ghcr.io/radusuciu/snakemake-executor-plugin-aws-basic-batch:latest
|
|
8
|
+
|
|
9
|
+
# =============================================================================
|
|
10
|
+
# Builder stage: install dependencies with uv
|
|
11
|
+
# =============================================================================
|
|
12
|
+
FROM python:${PYTHON_VERSION}-slim-bookworm AS builder
|
|
13
|
+
|
|
14
|
+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
|
15
|
+
|
|
16
|
+
ENV UV_COMPILE_BYTECODE=1 \
|
|
17
|
+
UV_LINK_MODE=copy
|
|
18
|
+
|
|
19
|
+
WORKDIR /app
|
|
20
|
+
|
|
21
|
+
# Copy dependency files first (better layer caching)
|
|
22
|
+
COPY pyproject.toml uv.lock ./
|
|
23
|
+
|
|
24
|
+
# Sync dependencies
|
|
25
|
+
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
26
|
+
uv sync --frozen --no-install-project --no-dev
|
|
27
|
+
|
|
28
|
+
# =============================================================================
|
|
29
|
+
# Runtime stage: minimal image with workflow
|
|
30
|
+
# =============================================================================
|
|
31
|
+
FROM python:${PYTHON_VERSION}-slim-bookworm AS runtime
|
|
32
|
+
|
|
33
|
+
# Create non-root user
|
|
34
|
+
RUN groupadd --gid 1000 snakemake && \
|
|
35
|
+
useradd --uid 1000 --gid 1000 --create-home snakemake
|
|
36
|
+
|
|
37
|
+
# Copy virtual environment from builder
|
|
38
|
+
COPY --from=builder --chown=snakemake:snakemake /app/.venv /app/.venv
|
|
39
|
+
|
|
40
|
+
ENV PATH="/app/.venv/bin:$PATH"
|
|
41
|
+
|
|
42
|
+
USER snakemake
|
|
43
|
+
WORKDIR /workflow
|
|
44
|
+
|
|
45
|
+
# Copy workflow files
|
|
46
|
+
COPY --chown=snakemake:snakemake Snakefile ./
|
|
47
|
+
|
|
48
|
+
CMD ["snakemake", "--help"]
|
|
49
|
+
|
|
50
|
+
# =============================================================================
|
|
51
|
+
# Coordinator stage: base plugin image with workflow files
|
|
52
|
+
# =============================================================================
|
|
53
|
+
FROM ${COORDINATOR_IMAGE} AS coordinator
|
|
54
|
+
|
|
55
|
+
# Copy workflow files
|
|
56
|
+
COPY --chown=snakemake:snakemake Snakefile ./
|
|
@@ -24,37 +24,26 @@ terraform apply
|
|
|
24
24
|
|
|
25
25
|
### 2. Deploy Workflow Infrastructure
|
|
26
26
|
|
|
27
|
-
The workflow module creates workflow-specific resources (job definition, ECR
|
|
27
|
+
The workflow module creates workflow-specific resources (compute environment, job queue, job definition, ECR repositories for both workflow and coordinator images). It requires outputs from the coordinator:
|
|
28
28
|
|
|
29
29
|
```bash
|
|
30
|
-
|
|
31
|
-
just tf-
|
|
32
|
-
just tf-apply-new
|
|
33
|
-
|
|
34
|
-
# Or manually:
|
|
35
|
-
cd examples/terraform/simple-workflow
|
|
36
|
-
terraform init
|
|
37
|
-
terraform apply \
|
|
38
|
-
-var="job_queue_arn=$(terraform -chdir=../coordinator output -raw job_queue_arn)" \
|
|
39
|
-
-var="job_role_arn=$(terraform -chdir=../coordinator output -raw job_role_arn)" \
|
|
40
|
-
-var="execution_role_arn=$(terraform -chdir=../coordinator output -raw execution_role_arn)" \
|
|
41
|
-
-var="log_group_name=$(terraform -chdir=../coordinator output -raw log_group_name)" \
|
|
42
|
-
-var="log_group_arn=$(terraform -chdir=../coordinator output -raw log_group_arn)" \
|
|
43
|
-
-var="bucket_arn=$(terraform -chdir=../coordinator output -raw bucket_arn)"
|
|
30
|
+
just example::tf-init
|
|
31
|
+
just example::tf-apply-new
|
|
44
32
|
```
|
|
45
33
|
|
|
46
|
-
### 3.
|
|
34
|
+
### 3. Build and Push Images
|
|
47
35
|
|
|
48
|
-
|
|
36
|
+
Build and push both the coordinator and workflow images to ECR:
|
|
49
37
|
|
|
50
38
|
```bash
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
# From examples/terraform/simple-workflow:
|
|
55
|
-
terraform output # job_definition_name
|
|
39
|
+
just example::ecr-login
|
|
40
|
+
just example::build-push
|
|
56
41
|
```
|
|
57
42
|
|
|
43
|
+
This builds two images from the same Dockerfile:
|
|
44
|
+
- **Coordinator image**: Base plugin image with workflow files (Snakefile)
|
|
45
|
+
- **Workflow image**: Minimal image with workflow dependencies
|
|
46
|
+
|
|
58
47
|
## Running the Workflow
|
|
59
48
|
|
|
60
49
|
### Using Justfile (Recommended)
|
|
@@ -62,25 +51,23 @@ terraform output # job_definition_name
|
|
|
62
51
|
The justfile provides shortcuts for common operations:
|
|
63
52
|
|
|
64
53
|
```bash
|
|
65
|
-
cd examples/simple-workflow
|
|
66
|
-
|
|
67
54
|
# Submit coordinator job
|
|
68
|
-
just run
|
|
55
|
+
just example::run
|
|
69
56
|
|
|
70
57
|
# Monitor job status
|
|
71
|
-
just watch
|
|
58
|
+
just example::watch
|
|
72
59
|
|
|
73
60
|
# View logs
|
|
74
|
-
just logs
|
|
61
|
+
just example::logs
|
|
75
62
|
|
|
76
63
|
# Check status
|
|
77
|
-
just status
|
|
64
|
+
just example::status
|
|
78
65
|
```
|
|
79
66
|
|
|
80
67
|
Generate a snakemake command with your deployed infrastructure values:
|
|
81
68
|
|
|
82
69
|
```bash
|
|
83
|
-
just tf-snakemake-cmd
|
|
70
|
+
just example::tf-snakemake-cmd
|
|
84
71
|
```
|
|
85
72
|
|
|
86
73
|
### Option 1: Standard Mode (local orchestration)
|
|
@@ -105,8 +92,10 @@ snakemake --executor aws-basic-batch \
|
|
|
105
92
|
--aws-basic-batch-region <region> \
|
|
106
93
|
--aws-basic-batch-job-queue <queue-name> \
|
|
107
94
|
--aws-basic-batch-job-definition <job-def-name> \
|
|
108
|
-
--aws-basic-batch-coordinator \
|
|
95
|
+
--aws-basic-batch-coordinator true \
|
|
109
96
|
--aws-basic-batch-coordinator-job-definition <coordinator-job-def-name> \
|
|
97
|
+
--aws-basic-batch-coordinator-queue <coordinator-queue-name> \
|
|
98
|
+
--aws-basic-batch-coordinator-image <coordinator-image-uri> \
|
|
110
99
|
--default-storage-provider s3 \
|
|
111
100
|
--default-storage-prefix s3://<bucket-name>
|
|
112
101
|
```
|
|
@@ -1,72 +1,95 @@
|
|
|
1
1
|
# Simple Workflow Example
|
|
2
|
-
#
|
|
3
|
-
# either from Docker Hub or built locally via `just build-base` from the project root.
|
|
2
|
+
# Both coordinator and workflow images are built from this Dockerfile and pushed to ECR.
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
workflow_tf_dir := "../terraform/simple-workflow"
|
|
4
|
+
tf_dir := "../terraform"
|
|
7
5
|
|
|
8
6
|
# =============================================================================
|
|
9
7
|
# Build and Push
|
|
10
8
|
# =============================================================================
|
|
11
9
|
|
|
12
|
-
# Build the
|
|
13
|
-
build:
|
|
10
|
+
# Build the workflow image
|
|
11
|
+
build-workflow:
|
|
14
12
|
#!/usr/bin/env bash
|
|
15
13
|
set -euo pipefail
|
|
16
|
-
|
|
17
|
-
docker build -t "$
|
|
14
|
+
workflow_ecr=$(terraform -chdir={{tf_dir}} output -raw workflow_ecr_repository_url)
|
|
15
|
+
docker build --target runtime -t "$workflow_ecr:latest" .
|
|
16
|
+
|
|
17
|
+
# Build the coordinator image (includes workflow files)
|
|
18
|
+
build-coordinator:
|
|
19
|
+
#!/usr/bin/env bash
|
|
20
|
+
set -euo pipefail
|
|
21
|
+
coordinator_ecr=$(terraform -chdir={{tf_dir}} output -raw coordinator_ecr_repository_url)
|
|
22
|
+
docker build --target coordinator -t "$coordinator_ecr:latest" .
|
|
23
|
+
|
|
24
|
+
# Build both images
|
|
25
|
+
build: build-workflow build-coordinator
|
|
18
26
|
|
|
19
27
|
# Login to ECR
|
|
20
28
|
ecr-login:
|
|
21
29
|
#!/usr/bin/env bash
|
|
22
30
|
set -euo pipefail
|
|
23
|
-
region=$(terraform -chdir={{
|
|
24
|
-
|
|
25
|
-
|
|
31
|
+
region=$(terraform -chdir={{tf_dir}} output -raw region)
|
|
32
|
+
workflow_ecr=$(terraform -chdir={{tf_dir}} output -raw workflow_ecr_repository_url)
|
|
33
|
+
ecr_host="${workflow_ecr%%/*}"
|
|
34
|
+
aws ecr get-login-password --region "$region" | docker login --username AWS --password-stdin "$ecr_host"
|
|
35
|
+
|
|
36
|
+
# Push the workflow image to ECR
|
|
37
|
+
push-workflow: ecr-login
|
|
38
|
+
#!/usr/bin/env bash
|
|
39
|
+
set -euo pipefail
|
|
40
|
+
workflow_ecr=$(terraform -chdir={{tf_dir}} output -raw workflow_ecr_repository_url)
|
|
41
|
+
docker push "$workflow_ecr:latest"
|
|
26
42
|
|
|
27
|
-
# Push the
|
|
28
|
-
push: ecr-login
|
|
43
|
+
# Push the coordinator image to ECR
|
|
44
|
+
push-coordinator: ecr-login
|
|
29
45
|
#!/usr/bin/env bash
|
|
30
46
|
set -euo pipefail
|
|
31
|
-
|
|
32
|
-
docker push "$
|
|
47
|
+
coordinator_ecr=$(terraform -chdir={{tf_dir}} output -raw coordinator_ecr_repository_url)
|
|
48
|
+
docker push "$coordinator_ecr:latest"
|
|
33
49
|
|
|
34
|
-
#
|
|
50
|
+
# Push both images to ECR
|
|
51
|
+
push: push-workflow push-coordinator
|
|
52
|
+
|
|
53
|
+
# Build and push both images
|
|
35
54
|
build-push: build push
|
|
36
55
|
|
|
37
56
|
# =============================================================================
|
|
38
57
|
# Run and Monitor
|
|
39
58
|
# =============================================================================
|
|
40
59
|
|
|
60
|
+
# Directory containing this justfile
|
|
61
|
+
workflow_dir := justfile_directory()
|
|
62
|
+
|
|
41
63
|
# Submit coordinator job via snakemake plugin
|
|
42
64
|
run *args:
|
|
43
65
|
#!/usr/bin/env bash
|
|
44
66
|
set -euo pipefail
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
cd - > /dev/null
|
|
67
|
+
region=$(terraform -chdir={{tf_dir}} output -raw region)
|
|
68
|
+
coordinator_queue=$(terraform -chdir={{tf_dir}} output -raw coordinator_job_queue_name)
|
|
69
|
+
workflow_queue=$(terraform -chdir={{tf_dir}} output -raw workflow_job_queue_name)
|
|
70
|
+
bucket=$(terraform -chdir={{tf_dir}} output -raw bucket_name)
|
|
71
|
+
workflow_job_def=$(terraform -chdir={{tf_dir}} output -raw workflow_job_definition_name)
|
|
72
|
+
coordinator_job_def=$(terraform -chdir={{tf_dir}} output -raw coordinator_job_definition_name)
|
|
52
73
|
snakemake \
|
|
74
|
+
--snakefile "{{workflow_dir}}/Snakefile" \
|
|
53
75
|
--executor aws-basic-batch \
|
|
54
76
|
--aws-basic-batch-coordinator true \
|
|
55
77
|
--aws-basic-batch-region "$region" \
|
|
56
|
-
--aws-basic-batch-job-queue "$
|
|
78
|
+
--aws-basic-batch-job-queue "$workflow_queue" \
|
|
57
79
|
--aws-basic-batch-job-definition "$workflow_job_def" \
|
|
58
80
|
--aws-basic-batch-coordinator-job-definition "$coordinator_job_def" \
|
|
81
|
+
--aws-basic-batch-coordinator-queue "$coordinator_queue" \
|
|
59
82
|
--default-storage-provider s3 \
|
|
60
83
|
--default-storage-prefix "s3://$bucket" \
|
|
61
84
|
--jobs 10 \
|
|
62
85
|
--forceall \
|
|
63
|
-
{{args}} 2>&1 | tee /dev/stderr | grep -oP 'Coordinator job submitted: \K[a-f0-9-]+' >
|
|
86
|
+
{{args}} 2>&1 | tee /dev/stderr | grep -oP 'Coordinator job submitted: \K[a-f0-9-]+' > "{{workflow_dir}}/.last-job-id" || true
|
|
64
87
|
|
|
65
88
|
# Check status of last submitted job
|
|
66
89
|
status:
|
|
67
90
|
#!/usr/bin/env bash
|
|
68
91
|
set -euo pipefail
|
|
69
|
-
job_id=$(cat
|
|
92
|
+
job_id=$(cat "{{workflow_dir}}/.last-job-id" 2>/dev/null || echo "")
|
|
70
93
|
if [ -z "$job_id" ]; then
|
|
71
94
|
echo "No job ID found. Run 'just run' first."
|
|
72
95
|
exit 1
|
|
@@ -79,7 +102,7 @@ status:
|
|
|
79
102
|
logs:
|
|
80
103
|
#!/usr/bin/env bash
|
|
81
104
|
set -euo pipefail
|
|
82
|
-
job_id=$(cat
|
|
105
|
+
job_id=$(cat "{{workflow_dir}}/.last-job-id" 2>/dev/null || echo "")
|
|
83
106
|
if [ -z "$job_id" ]; then
|
|
84
107
|
echo "No job ID found. Run 'just run' first."
|
|
85
108
|
exit 1
|
|
@@ -90,7 +113,7 @@ logs:
|
|
|
90
113
|
echo "No log stream available yet. Job may still be starting."
|
|
91
114
|
exit 1
|
|
92
115
|
fi
|
|
93
|
-
log_group=$(terraform -chdir={{
|
|
116
|
+
log_group=$(terraform -chdir={{tf_dir}} output -raw log_group_name)
|
|
94
117
|
aws logs get-log-events \
|
|
95
118
|
--log-group-name "$log_group" \
|
|
96
119
|
--log-stream-name "$log_stream" \
|
|
@@ -100,7 +123,7 @@ logs:
|
|
|
100
123
|
watch:
|
|
101
124
|
#!/usr/bin/env bash
|
|
102
125
|
set -euo pipefail
|
|
103
|
-
job_id=$(cat
|
|
126
|
+
job_id=$(cat "{{workflow_dir}}/.last-job-id" 2>/dev/null || echo "")
|
|
104
127
|
if [ -z "$job_id" ]; then
|
|
105
128
|
echo "No job ID found. Run 'just run' first."
|
|
106
129
|
exit 1
|
|
@@ -118,57 +141,45 @@ watch:
|
|
|
118
141
|
|
|
119
142
|
# =============================================================================
|
|
120
143
|
# Infrastructure
|
|
121
|
-
# Requires coordinator to be deployed first via: terraform -chdir=../terraform/coordinator apply
|
|
122
144
|
# =============================================================================
|
|
123
145
|
|
|
124
|
-
# Initialize
|
|
146
|
+
# Initialize terraform
|
|
125
147
|
tf-init:
|
|
126
|
-
terraform -chdir={{
|
|
148
|
+
terraform -chdir={{tf_dir}} init
|
|
127
149
|
|
|
128
|
-
#
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
{{args}}
|
|
142
|
-
|
|
143
|
-
# Plan workflow infrastructure
|
|
144
|
-
tf-plan *args: (tf-with-coordinator-vars "plan" args)
|
|
145
|
-
|
|
146
|
-
# Apply workflow infrastructure
|
|
147
|
-
tf-apply-new *args: (tf-with-coordinator-vars "apply" args)
|
|
148
|
-
|
|
149
|
-
# Destroy workflow infrastructure
|
|
150
|
-
tf-destroy *args: (tf-with-coordinator-vars "destroy" args)
|
|
151
|
-
|
|
152
|
-
# Show workflow terraform outputs
|
|
150
|
+
# Plan infrastructure
|
|
151
|
+
tf-plan *args:
|
|
152
|
+
terraform -chdir={{tf_dir}} plan {{args}}
|
|
153
|
+
|
|
154
|
+
# Apply infrastructure
|
|
155
|
+
tf-apply *args:
|
|
156
|
+
terraform -chdir={{tf_dir}} apply {{args}}
|
|
157
|
+
|
|
158
|
+
# Destroy infrastructure
|
|
159
|
+
tf-destroy *args:
|
|
160
|
+
terraform -chdir={{tf_dir}} destroy {{args}}
|
|
161
|
+
|
|
162
|
+
# Show terraform outputs
|
|
153
163
|
tf-output *args:
|
|
154
|
-
terraform -chdir={{
|
|
164
|
+
terraform -chdir={{tf_dir}} output {{args}}
|
|
155
165
|
|
|
156
166
|
# Generate snakemake command using deployed infrastructure
|
|
157
167
|
tf-snakemake-cmd:
|
|
158
168
|
#!/usr/bin/env bash
|
|
159
169
|
set -euo pipefail
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
170
|
+
region=$(terraform -chdir={{tf_dir}} output -raw region)
|
|
171
|
+
coordinator_queue=$(terraform -chdir={{tf_dir}} output -raw coordinator_job_queue_name)
|
|
172
|
+
workflow_queue=$(terraform -chdir={{tf_dir}} output -raw workflow_job_queue_name)
|
|
173
|
+
bucket=$(terraform -chdir={{tf_dir}} output -raw bucket_name)
|
|
174
|
+
workflow_job_def=$(terraform -chdir={{tf_dir}} output -raw workflow_job_definition_name)
|
|
175
|
+
coordinator_job_def=$(terraform -chdir={{tf_dir}} output -raw coordinator_job_definition_name)
|
|
166
176
|
|
|
167
177
|
echo "snakemake --executor aws-basic-batch \\"
|
|
168
178
|
echo " --aws-basic-batch-region $region \\"
|
|
169
|
-
echo " --aws-basic-batch-job-queue $
|
|
179
|
+
echo " --aws-basic-batch-job-queue $workflow_queue \\"
|
|
170
180
|
echo " --aws-basic-batch-job-definition $workflow_job_def \\"
|
|
171
181
|
echo " --aws-basic-batch-coordinator true \\"
|
|
172
182
|
echo " --aws-basic-batch-coordinator-job-definition $coordinator_job_def \\"
|
|
183
|
+
echo " --aws-basic-batch-coordinator-queue $coordinator_queue \\"
|
|
173
184
|
echo " --default-storage-provider s3 \\"
|
|
174
185
|
echo " --default-storage-prefix s3://$bucket"
|