@@ -222,7 +222,7 @@ def get_job_doc_url(
222222 # https://raw.githubusercontent.com/InformaticsMatters/
223223 # virtual-screening/main/data-manager/docs
224224
225- doc_url : Optional [str ] = job_definition .get ("doc-url" , None )
225+ doc_url : Optional [str ] = job_definition .get ("doc-url" )
226226
227227 # If doc-url starts 'https://' just return it
228228 if doc_url and doc_url .startswith ("https://" ):
@@ -246,9 +246,7 @@ def get_pull_secret_names(job_definition: Dict[str, Any]) -> Set[str]:
246246 """
247247 names : Set [str ] = set ()
248248
249- # Check the environment block...
250- pull_secret : Optional [str ] = job_definition .get ("image" , {}).get ("pull-secret" )
251- if pull_secret :
249+ if pull_secret := job_definition .get ("image" , {}).get ("pull-secret" ):
252250 names .add (pull_secret )
253251
254252 return names
@@ -289,15 +287,14 @@ def get_file_assets(job_definition: Dict[str, Any]) -> List[Dict[str, str]]:
289287
290288 # Iterate through the file block...
291289 file_block : List [Dict [str , Any ]] = job_definition .get ("image" , {}).get ("file" , [])
292- for item in file_block :
293- if "account-server-asset" in item ["content-from" ]:
294- file_assets .append (
295- {
296- "asset-name" : item ["content-from" ]["account-server-asset" ]["name" ],
297- "image-file" : item ["name" ],
298- }
299- )
300-
290+ file_assets .extend (
291+ {
292+ "asset-name" : item ["content-from" ]["account-server-asset" ]["name" ],
293+ "image-file" : item ["name" ],
294+ }
295+ for item in file_block
296+ if "account-server-asset" in item ["content-from" ]
297+ )
301298 return file_assets
302299
303300
@@ -315,15 +312,14 @@ def get_environment_assets(job_definition: Dict[str, Any]) -> List[Dict[str, str
315312 environment : List [Dict [str , Any ]] = job_definition .get ("image" , {}).get (
316313 "environment" , []
317314 )
318- for item in environment :
319- if "account-server-asset" in item ["value-from" ]:
320- env_assets .append (
321- {
322- "asset-name" : item ["value-from" ]["account-server-asset" ]["name" ],
323- "variable" : item ["name" ],
324- }
325- )
326-
315+ env_assets .extend (
316+ {
317+ "asset-name" : item ["value-from" ]["account-server-asset" ]["name" ],
318+ "variable" : item ["name" ],
319+ }
320+ for item in environment
321+ if "account-server-asset" in item ["value-from" ]
322+ )
327323 return env_assets
328324
329325
@@ -343,12 +339,12 @@ def get_jobs_replaced(job_definition: Dict[str, Any]) -> Optional[List[str]]:
343339 return list (replaced )
344340
345341
346- def get_outputs (job_definition : Dict [str , Any ]) -> Optional [ Dict [str , Any ] ]:
342+ def get_outputs (job_definition : Dict [str , Any ]) -> Dict [str , Any ]:
347343 """Given a Job Definition this function returns the outputs declared."""
348344 return job_definition .get ("variables" , {}).get ("outputs" , {}).get ("properties" , {})
349345
350346
351- def get_inputs (job_definition : Dict [str , Any ]) -> Optional [ Dict [str , Any ] ]:
347+ def get_inputs (job_definition : Dict [str , Any ]) -> Dict [str , Any ]:
352348 """Given a Job Definition this function returns the inputs declared."""
353349 return job_definition .get ("variables" , {}).get ("inputs" , {}).get ("properties" , {})
354350
@@ -360,6 +356,30 @@ def get_image(job_definition: Dict[str, Any]) -> Tuple[str, str]:
360356 return image_name , image_tag
361357
362358
359+ def get_combine_variables (job_definition : Dict [str , Any ]) -> Set [str ]:
360+ """Returns the names of all (input) variables that are expected to representing
361+ multiple input files - indications that this is a 'combiner' job.
362+ These variables are of type 'files'."""
363+ results : Set [str ] = {
364+ variable
365+ for variable , definition in get_inputs (job_definition ).items ()
366+ if definition ["type" ] == "files"
367+ }
368+ return results
369+
370+
371+ def get_split_variables (job_definition : Dict [str , Any ]) -> Set [str ]:
372+ """Returns the names of all (out) variables that are expected to representing
373+ multiple out files - indications that this is a 'splitter' job.
374+ These variables are of type 'files'."""
375+ results : Set [str ] = {
376+ variable
377+ for variable , definition in get_outputs (job_definition ).items ()
378+ if definition ["type" ] == "files"
379+ }
380+ return results
381+
382+
363383def decode (
364384 template_text : str ,
365385 variable_map : Optional [Dict [str , str ]],
0 commit comments