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
Andreas Tsagkaropoulos
morphemic-preprocessor
Commits
86e23465
Commit
86e23465
authored
Feb 25, 2021
by
Mohamed Khalil Labidi
Browse files
First draft of the waiting solution
parent
9bbf96e7
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/activeeon/morphemic/PAGateway.java
View file @
86e23465
...
...
@@ -789,13 +789,23 @@ public class PAGateway {
tasksTokens
.
forEach
(
taskToken
->
{
String
suffix
=
"_"
+
tasksTokens
.
indexOf
(
taskToken
);
scriptTasks
.
addAll
(
createAppTasks
(
task
,
suffix
,
taskToken
));
scriptTasks
.
addAll
(
0
,
createAppTasks
(
task
,
suffix
,
taskToken
));
scriptTasks
.
add
(
0
,
createLockHandlerTask
(
task
.
getName
(),
suffix
,
taskToken
));
scriptTasks
.
get
(
1
).
addDependence
(
scriptTasks
.
get
(
0
));
});
}
return
scriptTasks
;
}
private
ScriptTask
createLockHandlerTask
(
String
taskName
,
String
suffix
,
String
taskToken
)
{
String
lockTaskName
=
"waitForLock_"
+
taskName
+
suffix
;
ScriptTask
lockHandlerTask
=
PAFactory
.
createBashScriptTaskFromFile
(
lockTaskName
,
"wait_for_lock_script.sh"
);
lockHandlerTask
.
addGenericInformation
(
"NODE_ACCESS_TOKEN"
,
taskToken
);
return
lockHandlerTask
;
}
private
void
setAllMandatoryDependencies
(
TaskFlowJob
paJob
,
Job
jobToSubmit
)
{
jobToSubmit
.
getTasks
().
forEach
(
task
->
{
if
(
task
.
getParentTasks
()
!=
null
&&
!
task
.
getParentTasks
().
isEmpty
())
{
...
...
src/main/resources/wait_for_lock_script.sh
0 → 100644
View file @
86e23465
i
=
0
while
[
`
ps aux |
grep
[
l]ock_is_held |
wc
-l
`
!=
0
]
;
do
echo
"Lock_is_held
$i
"
ps aux |
grep
[
l]ock_is_held
sleep
10
((
i
=
i+10
))
;
done
echo
"Exited the while loop, time spent:
$i
"
ps aux |
grep
[
a]pt
\ No newline at end of file
Write
Preview
Markdown
is supported
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