diff --git a/law/contrib/arc/workflow.py b/law/contrib/arc/workflow.py index 90082bb9..276b6688 100644 --- a/law/contrib/arc/workflow.py +++ b/law/contrib/arc/workflow.py @@ -76,7 +76,7 @@ def create_job_file(self, job_num, branches): proxy_cmd = ProxyCommand( task.as_branch(branches[0]), exclude_task_args=exclude_args, - exclude_global_args=["workers", "local-scheduler"], + exclude_global_args=["workers", "local-scheduler", task.task_family + "-*"], ) if task.arc_use_local_scheduler(): proxy_cmd.add_arg("--local-scheduler", "True", overwrite=True) diff --git a/law/contrib/cms/workflow.py b/law/contrib/cms/workflow.py index cf046c7b..5a3b5921 100644 --- a/law/contrib/cms/workflow.py +++ b/law/contrib/cms/workflow.py @@ -104,7 +104,7 @@ def create_job_file(self, submit_jobs): proxy_cmd = ProxyCommand( task.as_branch(), exclude_task_args=exclude_args, - exclude_global_args=["workers"], + exclude_global_args=["workers", task.task_family + "-*"], ) proxy_cmd.add_arg("--local-scheduler", "True", overwrite=True) for key, value in OrderedDict(task.crab_cmdline_args()).items(): diff --git a/law/contrib/glite/workflow.py b/law/contrib/glite/workflow.py index 3343fba8..fe8c7cbf 100644 --- a/law/contrib/glite/workflow.py +++ b/law/contrib/glite/workflow.py @@ -94,7 +94,7 @@ def create_job_file(self, job_num, branches): proxy_cmd = ProxyCommand( task.as_branch(branches[0]), exclude_task_args=exclude_args, - exclude_global_args=["workers", "local-scheduler"], + exclude_global_args=["workers", "local-scheduler", task.task_family + "-*"], ) if task.glite_use_local_scheduler(): proxy_cmd.add_arg("--local-scheduler", "True", overwrite=True) diff --git a/law/contrib/htcondor/workflow.py b/law/contrib/htcondor/workflow.py index 360e8c88..c694ddd3 100644 --- a/law/contrib/htcondor/workflow.py +++ b/law/contrib/htcondor/workflow.py @@ -72,7 +72,7 @@ def create_job_file(self, job_num, branches): proxy_cmd = ProxyCommand( task.as_branch(branches[0]), exclude_task_args=exclude_args, - exclude_global_args=["workers", "local-scheduler"], + exclude_global_args=["workers", "local-scheduler", task.task_family + "-*"], ) if task.htcondor_use_local_scheduler(): proxy_cmd.add_arg("--local-scheduler", "True", overwrite=True) diff --git a/law/contrib/lsf/workflow.py b/law/contrib/lsf/workflow.py index c83b2bd8..5e4f4c2f 100644 --- a/law/contrib/lsf/workflow.py +++ b/law/contrib/lsf/workflow.py @@ -72,7 +72,7 @@ def create_job_file(self, job_num, branches): proxy_cmd = ProxyCommand( task.as_branch(branches[0]), exclude_task_args=exclude_args, - exclude_global_args=["workers", "local-scheduler"], + exclude_global_args=["workers", "local-scheduler", task.task_family + "-*"], ) if task.lsf_use_local_scheduler(): proxy_cmd.add_arg("--local-scheduler", "True", overwrite=True) diff --git a/law/contrib/slurm/workflow.py b/law/contrib/slurm/workflow.py index 6cc5b560..a77c91d8 100644 --- a/law/contrib/slurm/workflow.py +++ b/law/contrib/slurm/workflow.py @@ -71,7 +71,7 @@ def create_job_file(self, job_num, branches): proxy_cmd = ProxyCommand( task.as_branch(branches[0]), exclude_task_args=exclude_args, - exclude_global_args=["workers", "local-scheduler"], + exclude_global_args=["workers", "local-scheduler", task.task_family + "-*"], ) if task.slurm_use_local_scheduler(): proxy_cmd.add_arg("--local-scheduler", "True", overwrite=True) diff --git a/law/parser.py b/law/parser.py index 00cf0ca6..4662c112 100644 --- a/law/parser.py +++ b/law/parser.py @@ -13,6 +13,7 @@ import luigi from law.logger import get_logger +from law.util import multi_match logger = get_logger(__name__) @@ -152,10 +153,11 @@ def global_cmdline_args(exclude=None): if exclude: args = OrderedDict(args) - for key in exclude: - if not key.startswith("--"): - key = "--" + key.lstrip("-") - args.pop(key, None) + # treat arguments in exclude as patterns + _exclude = ["--" + pattern.lstrip("-") for pattern in exclude] + for arg in list(args.keys()): + if multi_match(arg, _exclude, mode=any): + args.pop(arg) return args