-
Notifications
You must be signed in to change notification settings - Fork 139
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
Track pipeline flow progress #160
Comments
This is planned, yes. Why do you use exceptions? They are very hard to handle and take away flexibility you get from the pipe? |
@apotonick I use exceptions because I don't want to handle them. I have a mission critical system that expects always to have a happy path and if anything goes wrong, it should raise an error. |
What does the structure of this data look like? Is it just the name of the step that switched from right to left Maybe the path that was taken as an array of arrays? results.path =>
[
[:right, 'operation.new'],
[:right, 'contract.build'],
[:right, 'validate'],
[:left, 'model.save'],
[:left, 'handle_failure']
] |
@dnd that would be awesome :) - looks great! |
Yeah, that looks good to me, even though we will have an unlimited number of tracks in the next version, so we might have to use something like [
Flow::Left, "contract.build",
...] |
BTW, can I see some pseudo-code of how you'd use this on the outside, pleeheease? |
Technically [
[Pipetree::Flow::Left, ["contract.build", [
[Pipetree::Flow::Right, "operation.new"],
[Pipetree::Flow::Left, "contract.validate"]
]]]
] This would fit it similarly with what I was proposing in the gitter chat about returning a pair, or a triple with the failed return. This could then ultimately return the value as well at the end of the failed track? |
The question with multiple pipelines is: how then trbr is going to resolve that is success and what is not? 1 successful (right) and multiple left? How to switch them? |
@mensfeld Very simple, For now, I would suggest we only support an invisible third left track for the |
How does trailblazer/trailblazer-operation#6 play into the multiple tracks then? It's definitely not fail early, as it is supposed to leave the operation as a success. I suppose it could also apply to that issue for a desire to immediately fail an operation and do nothing else as well. The distinction we need to make is, is early exit a special case, or is it a separate track(s)? That specific conversation is probably more relevant on the issue I posted above though. |
"Fail early" is basically a hidden additional left track. "Early success" is the pendant on the right side! 😬 |
@mensfeld @apotonick I'm also very much interested in this, for pragmarb/pragma#24. Any updates or hints about how this could be accomplished? I feel like I'm not versed in the internals of TRB well enough to do this myself in a performant and idiomatic way. |
Case: I have a really simple policy: if anything goes wrong - raise an exception. I know I could handle this in the endpoint but for my case it is way more sufficient to do that here. The only thing that is missing is the information on the position: which step failed which means that to obtain that, I would have to put separate failure before each step.
Could we maybe track the position in the pipe, so in case of failure we know when the track was switched? I believe it would help a lot.
The text was updated successfully, but these errors were encountered: