insitro / redun

Yet another redundant workflow engine
https://insitro.github.io/redun/
Apache License 2.0
510 stars 43 forks source link

Dryrun does not yield expected output #94

Closed aksarkar closed 3 months ago

aksarkar commented 4 months ago

If I run the following example

import redun

redun_namespace = 'test'

@redun.task()
def task2(x):
  return x

@redun.task()
def task1(n):
  return [task2(x) for x in range(n)]

I get the following output

$ redun run --dryrun temp.py task1 --n 10
[redun] redun :: version 0.17.0
[redun] config dir: /home/ec2-user/vesalius/projects/pipelines/src/ldsc3/.redun
[redun] Start Execution c21e9b12-6f4f-44dd-bce4-f17c70686306:  redun run --dryrun temp.py task1 --n 10
[redun] Miss   Job 7bda1ff5:  New task 'test.task1()' is called with new arguments (task_hash=ad0f6459, args_hash=84e68145).
[redun] Dryrun Job 7bda1ff5:  test.task1(n='10') on default
[redun]
[redun] | JOB STATUS 2024/04/11 12:30:25
[redun] | TASK       PENDING RUNNING  FAILED  CACHED    DONE   TOTAL
[redun] |
[redun] | ALL              0       1       0       0       0       1
[redun] | test.task1       0       1       0       0       0       1
[redun]
[redun]
[redun] Execution duration: 0.37 seconds
[redun] Dryrun: Additional jobs would run.

However, I would expect to see a report on how much of the entire DAG reachable from the entry point I queried would be re-run vs retrieved from cache. This is for example what make -n does.

mattrasmus commented 3 months ago

Thanks @aksarkar for posting this issue.

Briefly, this is the best redun can do given how dynamic it's execution is. The way it implements dryrun is to try and execute the workflow from cache as far as it can until it reaches the frontier of jobs that have never been run before. It'll either tell you the entire workflow is uptodate, or halt saying which job(s) require running.

make -n is able to report more in its dryrun mode, because make's DAG can be entirely determined statically / upfront.

I'm happy to update the redun docs to make this distinction more clear, if that would help.

aksarkar commented 3 months ago

OK, it would be helpful to make the documentation more clear about this case.