-
Notifications
You must be signed in to change notification settings - Fork 47
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
How to detect failure to create a file? #105
Comments
Thanks for submitting this issue. I agree with your explanation of how redun reacted to your bug fix and how it treats non-existent Files. A few thoughts. Surprisingly, this case hasn't happened very often for us, but I can see how you encountered it.
Just checking, I assume the bug fix was outside of a task? Normally such a code change would also trigger a rerun of that part of the workflow. In case its helpful, if we wanted to be reactive to code changes also in the @task(hash_includes=[ok])
def create(path: str, content: str) -> File:
if ok():
with open(path, "w") as f:
f.write(content)
return File(path) For more info:
Thus far we have treated non-existent
There is a concept in redun called "value validity", where when trying to use an cached value we check if its still valid by calling the
In theory this could be changed to also require the Before actually implementing the changes listed above, I would need to think pretty hard about unintended consequences or breaking changes for use cases of the current behavior. At first glance, it does seem reasonable. Either way, if you were interested in having this new behavior for yourself right away, you could subclass
In our own code, we have implemented several kinds of I hope this helps. |
Thank you for your detailed response! This is not a blocker for me, so I will not attempt a quick work-around. My problem was caused by a function silently failing to create its output. I fixed it to fail properly and noisily! I understand what you are saying about using However, I do think that it is worth requiring a file to exist if it is specified as task output. I would really appreciate you considering incorporating that as new behaviour. I think it's the right thing in general. Thanks! |
There seems to be no way to trigger a re-run after failing to create a file.
As I develop my workflow, I find I may have a bug which causes an expected file not to be created at all. I am surprised this is not an error, since I have a File as output which doesn't exist in the filesystem.
Upon fixing my bug, subsequent runs of redun have no effect, as it seems to have happily cached the file as missing, and there is no changed state in the filesystem to trigger rerunning the task.
I think it should be an error if an output File from a task doesn't exist when the task completes?
Example workflow:
I understand that the
ok
function is not hashed as part of the task. That's not my concern. This is about missing files.The text was updated successfully, but these errors were encountered: