Skip to content

Commit

Permalink
finish
Browse files Browse the repository at this point in the history
Signed-off-by: Ayush Kamat <[email protected]>
  • Loading branch information
ayushkamat committed Oct 25, 2023
1 parent 9513eac commit 303a8ac
Showing 1 changed file with 24 additions and 4 deletions.
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

0 comments on commit 303a8ac

Please sign in to comment.