Comments (4)
You can add that logic in task itself to skip : https://github.com/dexecutor/dexecutor-core/wiki/How-Do-I-%3F#how-do-i-execute-tasks-conditionally-based-on-the-result-of-parent-tasks
from dexecutor-core.
I couldn't think of a way to do this using parentResutls. I think It's two different use case. ParentResults is for task execute conditions, it's "bottom-up". But taskIdToStartWith is DAG graph iterate method, it's "top-down"。
Since the executor is based on a DAG graph, I think it should be delt within DAG graph.
For example:
public Set<Node<T, R>> getInitialNodes(T startWith) {
Set<Node<T, R>> initialNodes = new LinkedHashSet<Node<T, R>>();
for (Entry<T, Node<T, R>> entry : this.nodes.entrySet()) {
Node<T, R> node = entry.getValue();
if (startWith == null) {
if (node.getInComingNodes().isEmpty()) {
initialNodes.add(node);
} else {
if (node.getValue().equals(startWith)) {
initialNodes.add(node);
}
}
}
return initialNodes;
}
from dexecutor-core.
That would be error prone, as there could be multiple starts, here is an example, in this case 1, 11 and 12 are starts
Here is how you can do it
private static class SleepyTaskProvider implements TaskProvider<String, String> {
public Task<String, String> provideTask(final String id) {
if ( (scenario == 1 || scenario == 5) && "A".equals(id)) {
return new EmptyTask();
} else {
return new Task<String, String>() {
@Override
public String execute() {
try {
//Perform some task
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
String result = id + "processed";
return result;
}
@Override
public boolean shouldExecute(ExecutionResults<String, String> parentResults) {
ExecutionResult<String, String> firstParentResult = parentResults.getFirst();
//Do some logic with parent result
if ("B".equals(id) && firstParentResult.isSkipped() && firstParentResult.getResult() == "No") {
return false;
}
return true;
}
};
}
}
from dexecutor-core.
Closing this ticket for now
from dexecutor-core.
Related Issues (20)
- Release of the changes to get result of all the processed nodes. HOT 1
- Run particular independent task sequentially HOT 5
- Control Task execution order HOT 2
- Handling multiple requests HOT 7
- 哪里看咱们这个这资料呢 HOT 1
- How to generate visual pictures HOT 7
- Is there any API description document? HOT 1
- Timeout issue HOT 3
- Is it possible to interrupt a running task? HOT 4
- Spring Support HOT 4
- Timeout and cancellation support HOT 9
- Stuck on executing parallel task n-1 of total n tasks HOT 15
- How to stop the task or the entire graph from executing? HOT 4
- Support for persitence, pause / resume executions HOT 9
- Task.endTime is null when arriving to listener (onSuccess, onError) HOT 4
- Distributed Execution Targeting HOT 2
- API to execute only a subset of the dependencies
- Add judging condition for function areAlreadyProcessed HOT 1
- DefaultEngine will throw a NPE when a task throws a Error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dexecutor-core.