Skip to content

Commit

Permalink
fix: in addition to localrules statement, infer that job is local if …
Browse files Browse the repository at this point in the history
…it has any input or output file that is marked as local (#2541)

### QC
<!-- Make sure that you can tick the boxes below. -->

* [x] The PR contains a test case for the changes or the changes are
already covered by an existing test case.
* [x] The documentation (`docs/`) is updated to reflect the changes or
this is not necessary (e.g. if the change does neither modify the
language nor the behavior or functionalities of Snakemake).
  • Loading branch information
johanneskoester committed Dec 11, 2023
1 parent d9231c3 commit e8b682b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions snakemake/jobs.py
Expand Up @@ -906,7 +906,14 @@ def properties(self, omit_resources=["_cores", "_nodes"], **aux_properties):

@property
def is_local(self):
return self.dag.workflow.is_local(self.rule)
no_shared_fs = (
SharedFSUsage.INPUT_OUTPUT
not in self.dag.workflow.storage_settings.shared_fs_usage
)
return self.dag.workflow.is_local(self.rule) or (
no_shared_fs
and any(is_flagged(f, "local") for f in chain(self.input, self.output))
)

def __repr__(self):
return self.rule.name
Expand Down Expand Up @@ -1406,7 +1413,7 @@ def priority(self):

@property
def is_local(self):
return all(job.is_local for job in self.jobs)
return any(job.is_local for job in self.jobs)

def merged_wildcards(self):
jobs = iter(self.jobs)
Expand Down

0 comments on commit e8b682b

Please sign in to comment.