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
Melodic
morphemic-preprocessor
Commits
fc91ed11
Commit
fc91ed11
authored
Aug 27, 2021
by
Mohamed Khalil Labidi
Browse files
Fix SAL to handle BYON nodes registration before job creation scenario:issues 92 and 93
parent
19965d59
Changes
2
Hide whitespace changes
Inline
Side-by-side
scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/PAGateway.java
View file @
fc91ed11
...
...
@@ -494,7 +494,7 @@ public class PAGateway {
filename
=
File
.
separator
+
"Define_NS_BYON.xml"
;
variables
.
put
(
"NS_name"
,
nodeSourceName
);
variables
.
put
(
"pa_protocol"
,
"http"
);
variables
.
put
(
"tokens"
,
"BYON_"
+
byonNode
.
getJob
().
getJobId
());
variables
.
put
(
"tokens"
,
"BYON_"
+
byonNode
.
getJobId
());
variables
.
put
(
"ssh_username"
,
byonNode
.
getLoginCredential
().
getUsername
());
variables
.
put
(
"ssh_password"
,
byonNode
.
getLoginCredential
().
getPassword
());
/* IMPORTANT: Later we should relay only on the ssh_key. For now all the nodes must have the same login
...
...
@@ -633,8 +633,6 @@ public class PAGateway {
public
ByonNode
registerNewByonNode
(
ByonDefinition
byonNodeDefinition
,
String
jobId
)
{
Validate
.
notNull
(
byonNodeDefinition
,
"The received Byon node definition is empty. Nothing to be registered."
);
Validate
.
notNull
(
jobId
,
"The received jobId is empty. Nothing to be registered."
);
Job
job
=
EntityManagerHelper
.
find
(
Job
.
class
,
jobId
);
assert
job
!=
null
;
LOGGER
.
info
(
"Registering a new BYON definition related to job "
+
jobId
+
" ..."
);
NodeCandidate
byonNC
=
ByonUtils
.
createByonNodeCandidate
(
byonNodeDefinition
,
jobId
);
...
...
@@ -644,7 +642,7 @@ public class PAGateway {
newByonNode
.
setLoginCredential
(
byonNodeDefinition
.
getLoginCredential
());
newByonNode
.
setIpAddresses
(
byonNodeDefinition
.
getIpAddresses
());
newByonNode
.
setNodeProperties
(
byonNodeDefinition
.
getNodeProperties
());
newByonNode
.
setJob
(
job
);
newByonNode
.
setJob
Id
(
job
Id
);
newByonNode
.
setNodeCandidate
(
byonNC
);
EntityManagerHelper
.
persist
(
newByonNode
);
...
...
@@ -671,7 +669,7 @@ public class PAGateway {
return
listByonNodes
;
}
else
{
for
(
ByonNode
byonNode
:
listByonNodes
)
{
if
(
byonNode
.
getJob
().
getJobId
().
equals
(
job
Id
))
{
if
(
jobId
.
equals
(
byonNode
.
getJobId
()
))
{
filteredByonNodes
.
add
(
byonNode
);
}
}
...
...
@@ -692,9 +690,9 @@ public class PAGateway {
Validate
.
notNull
(
byonIdPerComponent
,
"The received byonIdPerComponent structure is empty. Nothing to be added."
);
EntityManagerHelper
.
begin
();
byonIdPerComponent
.
forEach
((
byonNodeId
,
component
Id
)
->
{
byonIdPerComponent
.
forEach
((
byonNodeId
,
component
Name
)
->
{
ByonNode
byonNode
=
EntityManagerHelper
.
find
(
ByonNode
.
class
,
byonNodeId
);
Task
task
=
EntityManagerHelper
.
find
(
Task
.
class
,
component
Id
);
Task
task
=
EntityManagerHelper
.
find
(
Task
.
class
,
jobId
+
component
Name
);
assert
byonNode
!=
null
:
"The BYON ID passed in the mapping does not exist in the database"
;
assert
task
!=
null
:
"The componentId passed in the mapping does not exist in the database"
;
...
...
@@ -706,9 +704,9 @@ public class PAGateway {
List
<
ByonNode
>
byonNodeList
=
new
LinkedList
<>();
byonNodeList
.
add
(
byonNode
);
LOGGER
.
info
(
"BYON node Added: "
+
byonNode
.
getName
()
+
" Ip: "
+
byonNode
.
getIpAddresses
().
get
(
0
).
getValue
()
);
defineByonNodeSource
(
byonNodeList
,
"BYON_NS_"
+
byonNode
.
getId
());
LOGGER
.
info
(
"BYON node source BYON_NS_"
+
byonNode
.
getId
()
+
" is defined"
);
LOGGER
.
info
(
"BYON node Added: "
+
byonNode
.
getName
()
+
" Ip: "
+
byonNode
.
getIpAddresses
().
get
(
0
).
getValue
());
defineByonNodeSource
(
byonNodeList
,
"BYON_NS_"
+
byonNode
.
getId
());
LOGGER
.
info
(
"BYON node source BYON_NS_"
+
byonNode
.
getId
()
+
" is defined"
);
newDeployment
.
setTask
(
task
);
newDeployment
.
setNumber
(
task
.
getNextDeploymentID
());
...
...
scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/model/ByonNode.java
View file @
fc91ed11
...
...
@@ -64,8 +64,9 @@ public class ByonNode implements Serializable {
@JsonProperty
(
"allocated"
)
private
Boolean
allocated
=
null
;
@ManyToOne
(
fetch
=
FetchType
.
EAGER
,
cascade
=
CascadeType
.
REFRESH
)
private
Job
job
;
@Column
(
name
=
"JOB_ID"
)
@JsonProperty
(
"jobId"
)
private
String
jobId
;
public
ByonNode
name
(
String
name
)
{
this
.
name
=
name
;
...
...
@@ -198,7 +199,8 @@ public class ByonNode implements Serializable {
Objects
.
equals
(
this
.
nodeCandidate
,
byonNode
.
nodeCandidate
)
&&
Objects
.
equals
(
this
.
id
,
byonNode
.
id
)
&&
Objects
.
equals
(
this
.
userId
,
byonNode
.
userId
)
&&
Objects
.
equals
(
this
.
allocated
,
byonNode
.
allocated
);
Objects
.
equals
(
this
.
allocated
,
byonNode
.
allocated
)
&&
Objects
.
equals
(
this
.
jobId
,
byonNode
.
jobId
);
}
@Override
...
...
@@ -221,6 +223,7 @@ public class ByonNode implements Serializable {
sb
.
append
(
" id: "
).
append
(
toIndentedString
(
id
)).
append
(
"\n"
);
sb
.
append
(
" userId: "
).
append
(
toIndentedString
(
userId
)).
append
(
"\n"
);
sb
.
append
(
" allocated: "
).
append
(
toIndentedString
(
allocated
)).
append
(
"\n"
);
sb
.
append
(
" jobId: "
).
append
(
toIndentedString
(
jobId
)).
append
(
"\n"
);
sb
.
append
(
"}"
);
return
sb
.
toString
();
}
...
...
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