@@ -1526,6 +1526,20 @@ def workflow_params_to_subs(self, params) -> Dict[str, str]:
15261526
15271527 _FOLDER_INPUT_TYPES = ('image' , 'file' , 'array' , 'measurement' , 'executable' )
15281528
1529+ # Folder-type inputs that the user can supply as OMERO file-annotation IDs
1530+ # (i.e. not images — those are handled by Image_Transfer).
1531+ _FILE_ATTACHMENT_TYPES = ('file' , 'array' , 'measurement' , 'executable' )
1532+
1533+ def get_file_attachment_params (self , workflow : str ) -> Dict [str , Dict [str , Any ]]:
1534+ """Return only the file-attachment params for a workflow.
1535+
1536+ Thin filter over :meth:`get_workflow_parameters`.
1537+ """
1538+ return {
1539+ k : v for k , v in self .get_workflow_parameters (workflow ).items ()
1540+ if v .get ('file_attachment' )
1541+ }
1542+
15291543 def _is_bilayers_workflow (self , descriptor : Dict ) -> bool :
15301544 """Return True if descriptor originated from a bilayers config."""
15311545 return descriptor .get ('schema-version' , '' ).startswith ('bilayers' )
@@ -1659,17 +1673,23 @@ def update_slurm_scripts(self,
16591673 logger .info ("Generating Slurm job scripts" )
16601674 for wf , job_path in self .slurm_model_jobs .items ():
16611675 # generate job script
1662- params = self .get_workflow_parameters (wf )
1676+ # All params in one call; file-attachment ones get type→'string'
1677+ # so the job script uses $VAR placeholders, not typed defaults.
1678+ all_params = self .get_workflow_parameters (wf )
1679+ merged_params = {
1680+ k : ({** v , 'type' : 'string' } if v ['file_attachment' ] else v )
1681+ for k , v in all_params .items ()
1682+ }
16631683 descriptor = self .generic_descriptor_from_github (wf )
16641684 if self ._is_bilayers_workflow (descriptor ):
16651685 template = "job_template_bilayers.sh"
16661686 folder_subs = self .workflow_bilayers_folder_params_to_subs (
16671687 descriptor )
1668- subs = {** self .workflow_params_to_subs (params ),
1688+ subs = {** self .workflow_params_to_subs (merged_params ),
16691689 ** folder_subs }
16701690 else :
16711691 template = "job_template.sh"
1672- subs = self .workflow_params_to_subs (params )
1692+ subs = self .workflow_params_to_subs (merged_params )
16731693 job_script = self .generate_slurm_job_for_workflow (
16741694 wf , subs , template )
16751695 # ensure all dirs exist remotely
@@ -2168,15 +2188,21 @@ def get_workflow_parameters(self,
21682188 # filter cytomine parameters
21692189 id_name = param .get ('id' )
21702190 if not id_name .startswith ('cytomine' ):
2171- # skip folder params managed by biomero (bilayers image/file inputs)
2172- if param .get ('set-by-server' ):
2191+ # skip folder params managed by biomero (bilayers image inputs, output dirs)
2192+ # but keep file-attachment params — they need CLI flags AND OMERO UI input
2193+ if param .get ('set-by-server' ) and not param .get ('file-attachment' ):
21732194 continue
2174- workflow_param = {'name' : id_name ,
2175- 'default' : param .get ('default-value' ),
2176- 'type' : param ['type' ],
2177- 'optional' : param ['optional' ],
2178- 'cmd_flag' : param .get ('command-line-flag' ).replace ("@id" , id_name ),
2179- 'description' : param ['description' ]}
2195+ raw_flag = param .get ('command-line-flag' ) or f'--{ id_name } '
2196+ workflow_param = {
2197+ 'name' : id_name ,
2198+ 'default' : param .get ('default-value' ),
2199+ 'type' : param ['type' ],
2200+ 'optional' : param ['optional' ],
2201+ 'cmd_flag' : raw_flag .replace ("@id" , id_name ),
2202+ 'description' : param ['description' ],
2203+ 'file_attachment' : bool (param .get ('file-attachment' )),
2204+ 'format' : param .get ('format' ) or [],
2205+ }
21802206 params_dict [id_name ] = workflow_param
21812207 return params_dict
21822208
0 commit comments