Skip to content

Commit

Permalink
feat: add method to obtain group args for spawned jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
johanneskoester committed Jan 16, 2024
1 parent 6ac8cd2 commit bd1b450
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions snakemake/spawn_jobs.py
Expand Up @@ -105,6 +105,23 @@ def get_shared_fs_usage_arg(self):
usage if usage else "none",
)

def get_group_args(self):
group_settings = self.workflow.group_settings
groups = format_cli_arg(
"--groups",
[
f"{rule}={group}"
for rule, group in group_settings.overwrite_groups.items()
],
skip=not group_settings.overwrite_groups,
)
group_components = format_cli_arg(
"--group-components",
[f"{group}={n}" for group, n in group_settings.group_components.items()],
skip=not group_settings.group_components,
)
return join_cli_args([groups, group_components])

def workflow_property_to_arg(
self, property, flag=None, quote=True, skip=False, invert=False, attr=None
):
Expand Down Expand Up @@ -176,6 +193,7 @@ def general_args(
self,
pass_default_storage_provider_args: bool = True,
pass_default_resources_args: bool = False,
pass_group_args: bool = False,
) -> str:
"""Return a string to add to self.exec_job that includes additional
arguments from the command line. This is currently used in the
Expand Down Expand Up @@ -249,5 +267,7 @@ def general_args(
args.append(self.get_default_storage_provider_args())
if pass_default_resources_args:
args.append(w2a("resource_settings.default_resources", attr="args"))
if pass_group_args:
args.append(self.get_group_args())

return join_cli_args(args)

0 comments on commit bd1b450

Please sign in to comment.