Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
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
21 changes: 15 additions & 6 deletions .github/workflows/ci_mocked_api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,22 @@ jobs:
- name: 'Use gcloud CLI'
run: 'gcloud info'

# - id: 'auth'
# uses: 'google-github-actions/auth@v1'
# with:
# credentials_json: '${{ secrets.GCP_SA_KEY }}'
- name: Setup minio
uses: comfuture/minio-action@v1
with:
access_key: minio
secret_key: minio123
port: 9000

- name: Install MinIO Client CLI
run: |
curl -O https://dl.min.io/client/mc/release/linux-amd64/mc
chmod +x mc
sudo mv mc /usr/local/bin/

# - name: 'Set up GCloud SDK'
# uses: 'google-github-actions/setup-gcloud@v1'
- name: Configure MinIO client
run: |
mc alias set minio http://localhost:9000 minio minio123

- name: Run pytest
run: |
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ version = "0.5.0"
description = ""
authors = [
"Vanessa Sochat <[email protected]>",
"Johannes Koester <[email protected]>"
"Johannes Koester <[email protected]>",
"Tadas Bareikis <[email protected]>"
]
readme = "README.md"
license = "MIT"
Expand Down
11 changes: 9 additions & 2 deletions snakemake_executor_plugin_googlebatch/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def get_labels(self, job):
"""
Derive default labels for the job (and add custom)
"""
labels = {"snakemake-job": job.name}
labels = {"snakemake-job": self.fix_job_name(job.name)}
for contender in self.get_param(job, "labels").split(","):
if not contender:
continue
Expand Down Expand Up @@ -93,7 +93,7 @@ def generate_jobid(self, job):
Generate a random jobid
"""
uid = str(uuid.uuid4())
return job.name.replace("_", "-") + "-" + uid[0:6]
return self.fix_job_name(job.name) + "-" + uid[0:6]

def get_container(self, job, entrypoint=None, commands=None):
"""
Expand Down Expand Up @@ -180,6 +180,13 @@ def get_command_writer(self, job):
resources=job.resources,
)

def fix_job_name(self, name):
"""
Replace illegal symbols and fix the job name length to adhere to
the Google Batch API job ID and label naming restrictions
"""
return name.replace("_", "-").replace(".", "")[:50]

def run_job(self, job: JobExecutorInterface):
"""
Run the Google Batch job.
Expand Down