-
Notifications
You must be signed in to change notification settings - Fork 73
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
Generified Flow Search Algorithms #2
Conversation
…ntal analyzer for flow graphs
… avoid a cyclic plugin dependency
@jglick When you get a chance, can you give this a peek? It's intended to offer the more general APIs discussed in #1, but also allow for incremental caching of flow graph analysis due to the option to supply StopNodes (so you only analyze up to the last heads). Probably still a bit rough owing to late-night coding in some cases. But it gives the 3 basic iteration approaches, makes it fairly easy to plug in more (there's one case where we need depth-first-first, and an option to only operate on the enclosing block scopes only would be helpful). Key points:
Apologies if the above is rambling and/or slightly incoherent. Check the timestamp and you'll see why, I can clarify/explain tomorrow. |
Intended as a substitute for #1 IIUC. |
@jglick Correct, for that and more. I think it probably could use some convenience methods to make it more friendly for that sort of usage, but wanted to solicit input about how that could look. It may actually be easier for some of these cases (for example, the nested stage/label + excecutor node name combo) to use the visit method, and use its boolean returnVal to control search termination. |
Another use case is |
Yes, I think so... and, er we don't have to worry about a stack overflow with this mechanism in that case. |
|
||
scanner = new FlowScanner.DepthFirstScanner(); | ||
matches = scanner.findAllMatches(heads, null, matchEchoStep); | ||
Assert.assertTrue(matches.size() == 5); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assertEquals(5, matches.size());
…can figure out how to get it to use something like semaphore step
…lockHoppingScanner to indicate it is linear
…r, rewrite internals for iterator, add block test
…ests, fix blockhoppingscanner
…sted parallel blocks and blackListing
if (parents == null || parents.size() == 0) { | ||
// welp done with this node, guess we consult the queue? | ||
if (parents.isEmpty()) { | ||
// welp, we're done with this node, guess we consult the queue? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re:bee: |
<<<<<<< HEAD | ||
/** If true, we are walking from the flow end node and have a complete view of the flow | ||
* Needed because there are implications when not walking from a finished flow (blocks without a {@link BlockEndNode})*/ | ||
======= |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐛 merge conflicts here and elsewhere
@@ -33,7 +33,7 @@ | |||
</parent> | |||
<groupId>org.jenkins-ci.plugins.workflow</groupId> | |||
<artifactId>workflow-api</artifactId> | |||
<version>2.2-SNAPSHOT</version> | |||
<version>2.2-blockapis-SNAPSHOT</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert before merging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jglick Done.
re:bee: |
NodeType nextType = null; | ||
|
||
public ForkScanner() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment has not been addressed 🐜
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@oleg-nenashev I believe it was (check back at the original) -- you can invoke methods on a ForkScanner with no nodes feeding it, they'll return null, empty, or an exception as appropriate.
So 🐛 for missing myNext reset in Other code looks good to me |
…anded just the branch start nodes for a parallel block
@oleg-nenashev That covers the issue with the submitting the Parallel Branch Starts for only an incomplete flow as the heads -- in a fairly straightforward fashion. I guess re-bee potential for @jglick too if he likes |
re:bee: (do not understand the recent changes but…there is more test code, fine) |
Would be useful to have some protective code in setHeads() as well. |
Final bees, merging for release |
@reviewbybees done |
Provides a bundle of search and iteration APIs to simplify working with pipeline flow graphs (DAGs).
These are intended to be extensible for custom use cases, but provide a general API that covers what is needed.
For a rundown of the core APIs and how to work with them, see: https://github.com/jenkinsci/workflow-api-plugin/pull/2/files#diff-f8537b8acb35b350992eb264d4f9f207R43
In gist, we're offering some core primitives for working with the flow graph that are needed to do more involved work with the flow graph:
Notes:
General use cases:
WorkflowRun.getLogPrefix
.Pipeline Stage View: