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

sm make log files also outputs #334

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions latch_cli/snakemake/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,7 @@ def snakemake_dag_to_interface(
for x in job.input:
if x not in dep_outputs:
param = variable_name_for_value(x, job.input)
inputs[param] = (
LatchFile,
None,
)
inputs[param] = (LatchFile, None)

remote_path = (
Path("/.snakemake_latch") / "workflows" / wf_name / "inputs" / x
Expand Down Expand Up @@ -744,6 +741,19 @@ def compile(self, **kwargs):
else:
python_outputs[param] = LatchFile

for x in job.log:
assert isinstance(x, SnakemakeInputVal)

if x in target_files:
is_target = True
param = variable_name_for_value(x, job.log)
target_file_for_output_param[param] = x

if x.is_directory:
python_outputs[param] = LatchDir
else:
python_outputs[param] = LatchFile

dep_outputs: Dict[SnakemakeInputVal, JobOutputInfo] = {}
for dep, dep_files in self._dag.dependencies[job].items():
for o in dep.output:
Expand All @@ -758,6 +768,16 @@ def compile(self, **kwargs):
type_=LatchDir if o.is_directory else LatchFile,
)

for o in dep.log:
if o in dep_files:
assert isinstance(o, SnakemakeInputVal)

dep_outputs[o] = JobOutputInfo(
jobid=dep.jobid,
output_param_name=variable_name_for_value(o, dep.log),
type_=LatchDir if o.is_directory else LatchFile,
)

python_inputs: Dict[str, Union[Type[LatchFile], Type[LatchDir]]] = {}
promise_map: Dict[str, JobOutputInfo] = {}
for x in job.input:
Expand Down