Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ProActive
scheduling
Commits
194d9855
Unverified
Commit
194d9855
authored
Jun 03, 2020
by
Fabien Viale
Committed by
GitHub
Jun 03, 2020
Browse files
Merge pull request #3764 from fviale/master
Remove and comment recursive algorithm in InternalJob
parents
53343f01
57b023c1
Changes
3
Hide whitespace changes
Inline
Side-by-side
scheduler/scheduler-server/src/main/java/org/ow2/proactive/scheduler/job/InternalJob.java
View file @
194d9855
...
...
@@ -635,37 +635,48 @@ public abstract class InternalJob extends JobState {
return
true
;
}
/**
* Walk up <code>down</code>'s dependences until a task <code>name</code> is
* met
* <p>
* also walks weak references created by {@link FlowActionType#IF}
*
* @return the task names <code>name</code>, or null
*/
public
InternalTask
findTaskUp
(
String
name
,
InternalTask
down
)
{
InternalTask
ret
=
null
;
List
<
InternalTask
>
ideps
=
new
ArrayList
<>();
if
(
down
.
getIDependences
()
!=
null
)
{
ideps
.
addAll
(
down
.
getIDependences
());
}
if
(
down
.
getJoinedBranches
()
!=
null
)
{
ideps
.
addAll
(
down
.
getJoinedBranches
());
}
if
(
down
.
getIfBranch
()
!=
null
)
{
ideps
.
add
(
down
.
getIfBranch
());
}
for
(
InternalTask
up
:
ideps
)
{
if
(
up
.
getName
().
equals
(
name
))
{
ret
=
up
;
}
else
{
InternalTask
r
=
findTaskUp
(
name
,
up
);
if
(
r
!=
null
)
{
ret
=
r
;
}
// Recursive algorithm is causing issues on loops with a large number of tasks
// /**
// * Walk up <code>down</code>'s dependences until a task <code>name</code> is
// * met
// * <p>
// * also walks weak references created by {@link FlowActionType#IF}
// *
// * @return the task names <code>name</code>, or null
// */
// public InternalTask findTaskUp(String name, InternalTask down) {
// InternalTask ret = null;
// List<InternalTask> ideps = new ArrayList<>();
// if (down.getIDependences() != null) {
// ideps.addAll(down.getIDependences());
// }
// if (down.getJoinedBranches() != null) {
// ideps.addAll(down.getJoinedBranches());
// }
// if (down.getIfBranch() != null) {
// ideps.add(down.getIfBranch());
// }
// for (InternalTask up : ideps) {
// if (up.getName().equals(name)) {
// ret = up;
// } else {
// InternalTask r = findTaskUp(name, up);
// if (r != null) {
// ret = r;
// }
// }
// }
// return ret;
// }
// replaced findTaskUp call due to recursion issues
public
InternalTask
findTask
(
String
name
)
{
for
(
InternalTask
task
:
tasks
.
values
())
{
if
(
name
.
equals
(
task
.
getName
()))
{
return
task
;
}
}
return
ret
;
return
null
;
}
/**
...
...
scheduler/scheduler-server/src/main/java/org/ow2/proactive/scheduler/job/termination/handlers/TerminateIfTaskHandler.java
View file @
194d9855
...
...
@@ -170,7 +170,7 @@ public class TerminateIfTaskHandler {
targetElse
=
it
;
}
}
else
if
(
action
.
getTargetContinuation
().
equals
(
it
.
getName
()))
{
InternalTask
up
=
internalJob
.
findTask
Up
(
initiator
.
getName
()
,
it
);
InternalTask
up
=
internalJob
.
findTask
(
initiator
.
getName
());
if
(
up
!=
null
&&
up
.
equals
(
initiator
))
{
targetJoin
=
it
;
}
...
...
scheduler/scheduler-server/src/main/java/org/ow2/proactive/scheduler/job/termination/handlers/TerminateLoopHandler.java
View file @
194d9855
...
...
@@ -57,7 +57,7 @@ public class TerminateLoopHandler {
if
(
action
.
getTarget
().
equals
(
initiator
.
getName
()))
{
target
=
initiator
;
}
else
{
target
=
internalJob
.
findTask
Up
(
action
.
getTarget
()
,
initiator
);
target
=
internalJob
.
findTask
(
action
.
getTarget
());
}
boolean
replicateForNextLoopIteration
=
internalJob
.
replicateForNextLoopIteration
(
initiator
,
target
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment