File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
snakemake_executor_plugin_googlebatch Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ def get_labels(self, job):
5757 """
5858 Derive default labels for the job (and add custom)
5959 """
60- labels = {"snakemake-job" : job .name }
60+ labels = {"snakemake-job" : self . fix_job_name ( job .name ) }
6161 for contender in self .get_param (job , "labels" ).split ("," ):
6262 if not contender :
6363 continue
@@ -94,7 +94,7 @@ def generate_jobid(self, job):
9494 Generate a random jobid
9595 """
9696 uid = str (uuid .uuid4 ())
97- return job .name . replace ( "_" , "-" ) + "-" + uid [0 :6 ]
97+ return self . fix_job_name ( job .name ) + "-" + uid [0 :6 ]
9898
9999 def get_container (self , job , entrypoint = None , commands = None ):
100100 """
@@ -181,6 +181,13 @@ def get_command_writer(self, job):
181181 resources = job .resources ,
182182 )
183183
184+ def fix_job_name (self , name ):
185+ """
186+ Replace illegal symbols and fix the job name length to adhere to
187+ the Google Batch API job ID and label naming restrictions
188+ """
189+ return name .replace ("_" , "-" ).replace ("." , "" )[:50 ]
190+
184191 def run_job (self , job : JobExecutorInterface ):
185192 """
186193 Run the Google Batch job.
You can’t perform that action at this time.
0 commit comments