From 629a53117f57126b9670fb1636780a48248e1df9 Mon Sep 17 00:00:00 2001 From: Juny Kesumadewi Date: Mon, 26 Apr 2021 15:18:28 +1000 Subject: [PATCH 01/16] Apply janis pre-hook command --- janis_assistant/templates/base.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/janis_assistant/templates/base.py b/janis_assistant/templates/base.py index fe01efe..83191de 100644 --- a/janis_assistant/templates/base.py +++ b/janis_assistant/templates/base.py @@ -77,6 +77,14 @@ def submit_detatched_resume( ): import subprocess + if self.prejanis_hook() is not None: + script_name = "prejanis-hook.sh" + with open(script_name, "w") as f: + f.write(self.prejanis_hook()) + + subprocess.run(["source", script_name]) + + Logger.info( "Starting Janis in the background with: " + ( From af831ddbf06d3b7f1b61a5ebb74fa243f22d2035 Mon Sep 17 00:00:00 2001 From: Juny Kesumadewi Date: Mon, 26 Apr 2021 15:44:46 +1000 Subject: [PATCH 02/16] update script path --- janis_assistant/templates/base.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/janis_assistant/templates/base.py b/janis_assistant/templates/base.py index 83191de..7366717 100644 --- a/janis_assistant/templates/base.py +++ b/janis_assistant/templates/base.py @@ -1,4 +1,5 @@ import sys +import os from abc import ABC, abstractmethod from datetime import datetime from typing import Type, Optional, List, Dict @@ -78,7 +79,8 @@ def submit_detatched_resume( import subprocess if self.prejanis_hook() is not None: - script_name = "prejanis-hook.sh" + + script_name = os.path.join("intermediate_execution_dir", "prejanis-hook.sh") with open(script_name, "w") as f: f.write(self.prejanis_hook()) From 25a6c8708bc3299cacecca947933930087128b88 Mon Sep 17 00:00:00 2001 From: Juny Kesumadewi Date: Mon, 26 Apr 2021 18:00:00 +1000 Subject: [PATCH 03/16] Execute pre janis hook from command line --- janis_assistant/templates/base.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/janis_assistant/templates/base.py b/janis_assistant/templates/base.py index 7366717..e77d7b1 100644 --- a/janis_assistant/templates/base.py +++ b/janis_assistant/templates/base.py @@ -79,13 +79,7 @@ def submit_detatched_resume( import subprocess if self.prejanis_hook() is not None: - - script_name = os.path.join("intermediate_execution_dir", "prejanis-hook.sh") - with open(script_name, "w") as f: - f.write(self.prejanis_hook()) - - subprocess.run(["source", script_name]) - + subprocess.run(self.prejanis_hook()) Logger.info( "Starting Janis in the background with: " From 2c23cedab42fe9d45a79ca980067b9af4bb3786c Mon Sep 17 00:00:00 2001 From: Juny Kesumadewi Date: Mon, 26 Apr 2021 18:31:19 +1000 Subject: [PATCH 04/16] Add logging --- janis_assistant/templates/base.py | 1 + 1 file changed, 1 insertion(+) diff --git a/janis_assistant/templates/base.py b/janis_assistant/templates/base.py index e77d7b1..b6473b0 100644 --- a/janis_assistant/templates/base.py +++ b/janis_assistant/templates/base.py @@ -79,6 +79,7 @@ def submit_detatched_resume( import subprocess if self.prejanis_hook() is not None: + Logger.info(f"running prejanis_hook with: {self.prejanis_hook()}") subprocess.run(self.prejanis_hook()) Logger.info( From bfe43abc9ba7bb8690d50314161c595e0b1fcbe3 Mon Sep 17 00:00:00 2001 From: Juny Kesumadewi Date: Mon, 26 Apr 2021 18:48:09 +1000 Subject: [PATCH 05/16] Execute prejanis hook earlier --- janis_assistant/main.py | 6 ++++++ janis_assistant/templates/base.py | 4 ---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/janis_assistant/main.py b/janis_assistant/main.py index e8db2b7..7461515 100644 --- a/janis_assistant/main.py +++ b/janis_assistant/main.py @@ -9,6 +9,7 @@ import os import sys import time +import subprocess from datetime import datetime from inspect import isclass from textwrap import dedent @@ -522,6 +523,11 @@ def run_from_jobfile( jobfile.execution_dir = row.execution_dir jobfile.output_dir = row.output_dir + prejanis = jobfile.template.template.prejanis_hook() + if prejanis is not None: + Logger.info(f"running prejanis_hook with: {prejanis}") + subprocess.run(prejanis) + # set logger for submit Logger.set_write_level(Logger.CONSOLE_LEVEL) logpath = os.path.join( diff --git a/janis_assistant/templates/base.py b/janis_assistant/templates/base.py index b6473b0..bfdb616 100644 --- a/janis_assistant/templates/base.py +++ b/janis_assistant/templates/base.py @@ -78,10 +78,6 @@ def submit_detatched_resume( ): import subprocess - if self.prejanis_hook() is not None: - Logger.info(f"running prejanis_hook with: {self.prejanis_hook()}") - subprocess.run(self.prejanis_hook()) - Logger.info( "Starting Janis in the background with: " + ( From 423a9aaa0017dfc6ddc04f090bacef66108a3d86 Mon Sep 17 00:00:00 2001 From: Juny Kesumadewi Date: Mon, 26 Apr 2021 18:54:46 +1000 Subject: [PATCH 06/16] run string command --- janis_assistant/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/janis_assistant/main.py b/janis_assistant/main.py index 7461515..44891bb 100644 --- a/janis_assistant/main.py +++ b/janis_assistant/main.py @@ -526,7 +526,7 @@ def run_from_jobfile( prejanis = jobfile.template.template.prejanis_hook() if prejanis is not None: Logger.info(f"running prejanis_hook with: {prejanis}") - subprocess.run(prejanis) + subprocess.run(prejanis, shell=True) # set logger for submit Logger.set_write_level(Logger.CONSOLE_LEVEL) From 4c566c91244ad5d9d2033dc53b7b509672c43f82 Mon Sep 17 00:00:00 2001 From: Juny Kesumadewi Date: Mon, 26 Apr 2021 19:47:21 +1000 Subject: [PATCH 07/16] auto load singularity of command found --- janis_assistant/containers/base.py | 5 +++-- janis_assistant/containers/docker.py | 5 +++-- janis_assistant/containers/singularity.py | 22 ++++++++++++++++++---- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/janis_assistant/containers/base.py b/janis_assistant/containers/base.py index fbd197a..16d65f3 100644 --- a/janis_assistant/containers/base.py +++ b/janis_assistant/containers/base.py @@ -1,6 +1,7 @@ from abc import abstractmethod, ABC from enum import Enum -from typing import Dict +from typing import Dict, Optional +from janis_assistant.templates import EnvironmentTemplate class ContainerType(Enum): @@ -41,7 +42,7 @@ def get_container_type(): @staticmethod @abstractmethod - def test_available_by_getting_version() -> str: + def test_available_by_getting_version(template: Optional[EnvironmentTemplate] = None) -> str: """ Test if the container environment is available, raise the ContainerEnvNotFound if not. :return: diff --git a/janis_assistant/containers/docker.py b/janis_assistant/containers/docker.py index be8a147..09c575f 100644 --- a/janis_assistant/containers/docker.py +++ b/janis_assistant/containers/docker.py @@ -1,9 +1,10 @@ import subprocess -from typing import Dict +from typing import Dict, Optional from janis_core import Logger from janis_assistant.containers.base import Container, ContainerType +from janis_assistant.templates import EnvironmentTemplate class Docker(Container): @@ -31,7 +32,7 @@ def get_container_type(): return ContainerType.docker @staticmethod - def test_available_by_getting_version() -> str: + def test_available_by_getting_version(template: Optional[EnvironmentTemplate] = None) -> str: try: return subprocess.check_output(["docker", "-v"]).decode() except subprocess.CalledProcessError as e: diff --git a/janis_assistant/containers/singularity.py b/janis_assistant/containers/singularity.py index edd170b..f3f954f 100644 --- a/janis_assistant/containers/singularity.py +++ b/janis_assistant/containers/singularity.py @@ -1,12 +1,13 @@ import os import subprocess -from typing import Dict +from typing import Dict, Optional from janis_core import Logger from janis_assistant.containers.base import Container, ContainerType from janis_assistant.utils import generate_new_id, ProcessLogger +from janis_assistant.templates import EnvironmentTemplate class Singularity(Container): @@ -41,7 +42,7 @@ def get_build_instructions_for(containerlocation: str, docker: str): return ["singularity", "pull", containerlocation, "docker://" + docker] @staticmethod - def test_available_by_getting_version() -> str: + def test_available_by_getting_version(template: Optional[EnvironmentTemplate] = None) -> str: try: version = subprocess.check_output(["singularity", "--version"]).decode() import re @@ -58,8 +59,21 @@ def test_available_by_getting_version() -> str: ) return version - except subprocess.CalledProcessError as e: - raise Container.ContainerEnvNotFound("singularity", e) + # except subprocess.CalledProcessError as e: + # raise Container.ContainerEnvNotFound("singularity", e) + except Exception as e: + if template is not None and template.singularity_load_instructions is not None: + try: + Logger.info("Trying to load singularity") + + command = template.singularity_load_instructions + if template.singularity_version: + command += f"/{template.singularity_version}" + subprocess.run(command, shell=True) + except Exception as e: + raise Container.ContainerEnvNotFound("singularity", e) + else: + raise Container.ContainerEnvNotFound("singularity", e) def start_container(self): From 1873396d8778df45178a0a76189a5377826a1991 Mon Sep 17 00:00:00 2001 From: Juny Kesumadewi Date: Mon, 26 Apr 2021 20:39:09 +1000 Subject: [PATCH 08/16] handle auto load singularity --- janis_assistant/containers/base.py | 3 +-- janis_assistant/containers/docker.py | 3 +-- janis_assistant/containers/singularity.py | 10 +++------- janis_assistant/main.py | 5 ----- janis_assistant/management/workflowmanager.py | 3 ++- janis_assistant/templates/base.py | 3 +++ janis_assistant/templates/slurm.py | 3 +++ 7 files changed, 13 insertions(+), 17 deletions(-) diff --git a/janis_assistant/containers/base.py b/janis_assistant/containers/base.py index 16d65f3..65bced3 100644 --- a/janis_assistant/containers/base.py +++ b/janis_assistant/containers/base.py @@ -1,7 +1,6 @@ from abc import abstractmethod, ABC from enum import Enum from typing import Dict, Optional -from janis_assistant.templates import EnvironmentTemplate class ContainerType(Enum): @@ -42,7 +41,7 @@ def get_container_type(): @staticmethod @abstractmethod - def test_available_by_getting_version(template: Optional[EnvironmentTemplate] = None) -> str: + def test_available_by_getting_version(command: Optional[str] = None) -> str: """ Test if the container environment is available, raise the ContainerEnvNotFound if not. :return: diff --git a/janis_assistant/containers/docker.py b/janis_assistant/containers/docker.py index 09c575f..b81e3c6 100644 --- a/janis_assistant/containers/docker.py +++ b/janis_assistant/containers/docker.py @@ -4,7 +4,6 @@ from janis_core import Logger from janis_assistant.containers.base import Container, ContainerType -from janis_assistant.templates import EnvironmentTemplate class Docker(Container): @@ -32,7 +31,7 @@ def get_container_type(): return ContainerType.docker @staticmethod - def test_available_by_getting_version(template: Optional[EnvironmentTemplate] = None) -> str: + def test_available_by_getting_version(command: Optional[str] = None) -> str: try: return subprocess.check_output(["docker", "-v"]).decode() except subprocess.CalledProcessError as e: diff --git a/janis_assistant/containers/singularity.py b/janis_assistant/containers/singularity.py index f3f954f..0ee98bf 100644 --- a/janis_assistant/containers/singularity.py +++ b/janis_assistant/containers/singularity.py @@ -7,7 +7,6 @@ from janis_assistant.containers.base import Container, ContainerType from janis_assistant.utils import generate_new_id, ProcessLogger -from janis_assistant.templates import EnvironmentTemplate class Singularity(Container): @@ -42,7 +41,7 @@ def get_build_instructions_for(containerlocation: str, docker: str): return ["singularity", "pull", containerlocation, "docker://" + docker] @staticmethod - def test_available_by_getting_version(template: Optional[EnvironmentTemplate] = None) -> str: + def test_available_by_getting_version(command: Optional[str] = None) -> str: try: version = subprocess.check_output(["singularity", "--version"]).decode() import re @@ -62,13 +61,10 @@ def test_available_by_getting_version(template: Optional[EnvironmentTemplate] = # except subprocess.CalledProcessError as e: # raise Container.ContainerEnvNotFound("singularity", e) except Exception as e: - if template is not None and template.singularity_load_instructions is not None: + + if command is not None: try: Logger.info("Trying to load singularity") - - command = template.singularity_load_instructions - if template.singularity_version: - command += f"/{template.singularity_version}" subprocess.run(command, shell=True) except Exception as e: raise Container.ContainerEnvNotFound("singularity", e) diff --git a/janis_assistant/main.py b/janis_assistant/main.py index 44891bb..77af442 100644 --- a/janis_assistant/main.py +++ b/janis_assistant/main.py @@ -523,11 +523,6 @@ def run_from_jobfile( jobfile.execution_dir = row.execution_dir jobfile.output_dir = row.output_dir - prejanis = jobfile.template.template.prejanis_hook() - if prejanis is not None: - Logger.info(f"running prejanis_hook with: {prejanis}") - subprocess.run(prejanis, shell=True) - # set logger for submit Logger.set_write_level(Logger.CONSOLE_LEVEL) logpath = os.path.join( diff --git a/janis_assistant/management/workflowmanager.py b/janis_assistant/management/workflowmanager.py index b40e186..f4c02ac 100644 --- a/janis_assistant/management/workflowmanager.py +++ b/janis_assistant/management/workflowmanager.py @@ -288,8 +288,9 @@ def start_or_submit(self, run_in_background, watch=False): jc = metadb.prepared_job PreparedJob._instance = jc + metadb.containertype = jc._container.__name__ - metadb.containerversion = jc._container.test_available_by_getting_version() + metadb.containerversion = jc._container.test_available_by_getting_version(jc.template.template.setup_container_command()) self.database.submission_metadata.save_changes() diff --git a/janis_assistant/templates/base.py b/janis_assistant/templates/base.py index bfdb616..542bca7 100644 --- a/janis_assistant/templates/base.py +++ b/janis_assistant/templates/base.py @@ -224,6 +224,9 @@ def prepare_run_test_command(self, test_command: List[str]) -> Optional[List]: """ return test_command + def setup_container_command(self): + return None + class SingularityEnvironmentTemplate(EnvironmentTemplate, ABC): def __init__( diff --git a/janis_assistant/templates/slurm.py b/janis_assistant/templates/slurm.py index c1a0e27..1cac637 100644 --- a/janis_assistant/templates/slurm.py +++ b/janis_assistant/templates/slurm.py @@ -225,3 +225,6 @@ def submit_detatched_resume( logsdir=logsdir, **kwargs, ) + + def setup_container_command(self): + return self.singularity_load_instructions From e2ce18bd7b8a66fe4041b6cde4476f466ecac396 Mon Sep 17 00:00:00 2001 From: Juny Kesumadewi Date: Mon, 26 Apr 2021 21:05:07 +1000 Subject: [PATCH 09/16] run prejanis hook --- janis_assistant/templates/base.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/janis_assistant/templates/base.py b/janis_assistant/templates/base.py index 542bca7..222e220 100644 --- a/janis_assistant/templates/base.py +++ b/janis_assistant/templates/base.py @@ -78,6 +78,9 @@ def submit_detatched_resume( ): import subprocess + if self.prejanis_hook() is not None: + command = f"{self.prejanis_hook()}; {command}" + Logger.info( "Starting Janis in the background with: " + ( From 4f4298c9f13153333173e0c5f0347b06c53040c7 Mon Sep 17 00:00:00 2001 From: Juny Kesumadewi Date: Mon, 26 Apr 2021 21:19:33 +1000 Subject: [PATCH 10/16] add prejanis hook command to the command list --- janis_assistant/management/workflowmanager.py | 4 ++++ janis_assistant/templates/base.py | 3 --- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/janis_assistant/management/workflowmanager.py b/janis_assistant/management/workflowmanager.py index f4c02ac..9f79c53 100644 --- a/janis_assistant/management/workflowmanager.py +++ b/janis_assistant/management/workflowmanager.py @@ -311,6 +311,10 @@ def start_or_submit(self, run_in_background, watch=False): "--foreground", self.execution_dir, ] + + if self.prejanis_hook() is not None: + command = [self.prejanis_hook()] + command + scriptdir = self.get_path_for_component(self.WorkflowManagerPath.configuration) logdir = self.get_path_for_component(self.WorkflowManagerPath.logs) diff --git a/janis_assistant/templates/base.py b/janis_assistant/templates/base.py index 222e220..542bca7 100644 --- a/janis_assistant/templates/base.py +++ b/janis_assistant/templates/base.py @@ -78,9 +78,6 @@ def submit_detatched_resume( ): import subprocess - if self.prejanis_hook() is not None: - command = f"{self.prejanis_hook()}; {command}" - Logger.info( "Starting Janis in the background with: " + ( From 4f197ea5b4b75827ef4220ed93b840628b1a65f3 Mon Sep 17 00:00:00 2001 From: Juny Kesumadewi Date: Mon, 26 Apr 2021 21:29:23 +1000 Subject: [PATCH 11/16] Fix syntax error --- janis_assistant/management/workflowmanager.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/janis_assistant/management/workflowmanager.py b/janis_assistant/management/workflowmanager.py index 9f79c53..050518a 100644 --- a/janis_assistant/management/workflowmanager.py +++ b/janis_assistant/management/workflowmanager.py @@ -312,8 +312,8 @@ def start_or_submit(self, run_in_background, watch=False): self.execution_dir, ] - if self.prejanis_hook() is not None: - command = [self.prejanis_hook()] + command + if self.jc.template.template.prejanis_hook() is not None: + command = [self.jc.template.template.prejanis_hook()] + command scriptdir = self.get_path_for_component(self.WorkflowManagerPath.configuration) logdir = self.get_path_for_component(self.WorkflowManagerPath.logs) From 116e7135a8051aa8d484f07a1d79e7b9063b3797 Mon Sep 17 00:00:00 2001 From: Juny Kesumadewi Date: Mon, 26 Apr 2021 21:30:49 +1000 Subject: [PATCH 12/16] Fix syntax error --- janis_assistant/management/workflowmanager.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/janis_assistant/management/workflowmanager.py b/janis_assistant/management/workflowmanager.py index 050518a..f6c5483 100644 --- a/janis_assistant/management/workflowmanager.py +++ b/janis_assistant/management/workflowmanager.py @@ -312,8 +312,8 @@ def start_or_submit(self, run_in_background, watch=False): self.execution_dir, ] - if self.jc.template.template.prejanis_hook() is not None: - command = [self.jc.template.template.prejanis_hook()] + command + if jc.template.template.prejanis_hook() is not None: + command = [jc.template.template.prejanis_hook()] + command scriptdir = self.get_path_for_component(self.WorkflowManagerPath.configuration) logdir = self.get_path_for_component(self.WorkflowManagerPath.logs) From b51402a90b6f8ea08e1d1b8a261817ebcc6a565e Mon Sep 17 00:00:00 2001 From: Juny Kesumadewi Date: Mon, 26 Apr 2021 21:39:57 +1000 Subject: [PATCH 13/16] separate prehook command and janis main command with semicolon --- janis_assistant/management/workflowmanager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/janis_assistant/management/workflowmanager.py b/janis_assistant/management/workflowmanager.py index f6c5483..fa3a55e 100644 --- a/janis_assistant/management/workflowmanager.py +++ b/janis_assistant/management/workflowmanager.py @@ -313,7 +313,7 @@ def start_or_submit(self, run_in_background, watch=False): ] if jc.template.template.prejanis_hook() is not None: - command = [jc.template.template.prejanis_hook()] + command + command = [f"{jc.template.template.prejanis_hook()};"] + command scriptdir = self.get_path_for_component(self.WorkflowManagerPath.configuration) logdir = self.get_path_for_component(self.WorkflowManagerPath.logs) From 978766d257d55055afa5bb88935b5a095d20f8fa Mon Sep 17 00:00:00 2001 From: Juny Kesumadewi Date: Fri, 30 Apr 2021 17:41:56 +1000 Subject: [PATCH 14/16] Update __meta__.py --- janis_assistant/__meta__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/janis_assistant/__meta__.py b/janis_assistant/__meta__.py index f377e64..ad8ed3e 100644 --- a/janis_assistant/__meta__.py +++ b/janis_assistant/__meta__.py @@ -1,4 +1,4 @@ -__version__ = "v0.11.5" +__version__ = "v0.11.6" DOCS_URL = "https://janis.readthedocs.io" GITHUB_URL = "https://github.com/PMCC-BioinformaticsCore/janis-assistant" ISSUE_URL = "https://github.com/PMCC-BioinformaticsCore/janis-assistant/issues/new" From 9cd0a62f9065681d72c4d67f8504e772e4112689 Mon Sep 17 00:00:00 2001 From: Juny Kesumadewi Date: Tue, 1 Jun 2021 18:13:17 +1000 Subject: [PATCH 15/16] allow auto download of remote files for Tool type (not just workflow) --- .../modifiers/remotefilemodifier.py | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/janis_assistant/modifiers/remotefilemodifier.py b/janis_assistant/modifiers/remotefilemodifier.py index 71ac4a1..61ac7e7 100644 --- a/janis_assistant/modifiers/remotefilemodifier.py +++ b/janis_assistant/modifiers/remotefilemodifier.py @@ -37,31 +37,26 @@ def inputs_modifier(self, tool: Tool, inputs: Dict, hints: Dict[str, str]) -> Di :return: modified input :rtype: dict """ - if not isinstance(tool, WorkflowBase): - return inputs - - wf: WorkflowBase = tool new_inputs = {} - for inpnode in wf.input_nodes.values(): + for inp in tool.tool_inputs(): modification_required = False - if isinstance(inpnode.datatype, File) or ( - isinstance(inpnode.datatype, Array) - and isinstance(inpnode.datatype.fundamental_type(), File) + if isinstance(inp.intype, File) or ( + isinstance(inp.intype, Array) + and isinstance(inp.intype.fundamental_type(), File) ): - if inpnode.id() in inputs and inputs[inpnode.id()] is not None: + if inp.id() in inputs and inputs[inp.id()] is not None: modification_required = True if modification_required: - doc: InputDocumentation = inpnode.doc - source = inputs[inpnode.id()] + source = inputs[inp.id()] basedir = self.cache_dir os.makedirs(basedir, exist_ok=True) - new_inputs[inpnode.id()] = self.localise_inputs( - inpnode.id(), - inpnode.datatype, + new_inputs[inp.id()] = self.localise_inputs( + inp.id(), + inp.intype, basedir, source, # mfranklin 2021-01-08: From 16f493c0e5af7a85821417684d6fc140f6651508 Mon Sep 17 00:00:00 2001 From: Juny Kesumadewi Date: Wed, 9 Jun 2021 13:12:34 +1000 Subject: [PATCH 16/16] Handle downloading secondary files of array types --- janis_assistant/modifiers/base.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/janis_assistant/modifiers/base.py b/janis_assistant/modifiers/base.py index e78445b..aa9c9d6 100644 --- a/janis_assistant/modifiers/base.py +++ b/janis_assistant/modifiers/base.py @@ -73,7 +73,12 @@ def localise_inputs( if localise_secondary_files: try: - for sec in inptype.secondary_files() or []: + # Handle normal input type or array input type + secondary_files = inptype.secondary_files() + if inptype.is_array(): + secondary_files = inptype.subtype().secondary_files() + + for sec in secondary_files or []: sec_source = apply_secondary_file_format_to_filename(source, sec) out_sec_path = apply_secondary_file_format_to_filename( out_path, sec