Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: keep flags with apply_wildcards on cloned IOFile #1416

Merged
merged 4 commits into from Feb 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion snakemake/dag.py
Expand Up @@ -280,7 +280,7 @@ def create_conda_envs(
env_set = {
(job.conda_env_spec, job.container_img_url)
for job in jobs
if job.conda_env_spec
if job.conda_env_spec and (self.workflow.run_local or job.is_local)
}
# Then based on md5sum values
self.conda_envs = dict()
Expand Down
4 changes: 2 additions & 2 deletions snakemake/executors/google_lifesciences.py
Expand Up @@ -62,7 +62,7 @@ def __init__(
# Attach variables for easy access
self.workflow = workflow
self.quiet = quiet
self.workdir = os.path.dirname(self.workflow.persistence.path)
self.workdir = os.path.realpath(os.path.dirname(self.workflow.persistence.path))
self._save_storage_cache = cache

# Relative path for running on instance
Expand Down Expand Up @@ -631,7 +631,7 @@ def _generate_build_source_package(self):
"""
# Workflow sources for cloud executor must all be under same workdir root
for filename in self.workflow_sources:
if self.workdir not in filename:
if self.workdir not in os.path.realpath(filename):
raise WorkflowError(
"All source files must be present in the working directory, "
"{workdir} to be uploaded to a build package that respects "
Expand Down
2 changes: 1 addition & 1 deletion snakemake/io.py
Expand Up @@ -735,7 +735,7 @@ def format_dynamic(self):
def clone_flags(self, other):
if isinstance(self._file, str):
self._file = AnnotatedString(self._file)
if isinstance(other._file, AnnotatedString):
if isinstance(other._file, AnnotatedString) or isinstance(other._file, _IOFile):
self._file.flags = getattr(other._file, "flags", {}).copy()
if "remote_object" in self._file.flags:
self._file.flags["remote_object"] = copy.copy(
Expand Down
1 change: 0 additions & 1 deletion snakemake/rules.py
Expand Up @@ -892,7 +892,6 @@ def concretize_param(p, wildcards, is_from_callable):
def handle_incomplete_checkpoint(exception):
"""If checkpoint is incomplete, target it such that it is completed
before this rule gets executed."""
print(exception.targetfile)
if exception.targetfile in input:
return TBDString()
else:
Expand Down
7 changes: 6 additions & 1 deletion tests/test_cloud_checkpoints_issue574/Snakefile
Expand Up @@ -19,9 +19,14 @@ checkpoint copy:
run:
shell("cp {input} {output}")

def get_pack_input(wildcards):
output = checkpoints.copy.get().output[0]
return output


rule pack:
input:
lambda wildcards: checkpoints.copy.get().output[0]
get_pack_input
output:
"landsat-data.txt.bz2"
conda:
Expand Down