Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.toolbox
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
slapos.toolbox
Commits
0f7a4d3e
Commit
0f7a4d3e
authored
Mar 28, 2012
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Webrunner Support more instances at the same time
parent
06350aed
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
105 additions
and
34 deletions
+105
-34
slapos/runner/static/js/scripts/inspectInstance.js
slapos/runner/static/js/scripts/inspectInstance.js
+36
-1
slapos/runner/templates/instanceInspect.html
slapos/runner/templates/instanceInspect.html
+57
-29
slapos/runner/utils.py
slapos/runner/utils.py
+10
-2
slapos/runner/views.py
slapos/runner/views.py
+2
-2
No files found.
slapos/runner/static/js/scripts/inspectInstance.js
View file @
0f7a4d3e
$
(
document
).
ready
(
function
()
{
$
(
document
).
ready
(
function
()
{
var
editor
;
var
editor
;
setupFileTree
();
setupFileTree
();
$
(
$
(
"
#slappart li
"
)[
0
]).
find
(
"
input:radio
"
).
attr
(
'
checked
'
,
true
);
$
(
"
.menu-box-right>div
"
).
css
(
'
min-height
'
,
$
(
"
#slappart li
"
).
length
*
26
+
20
+
"
px
"
);
configRadio
();
var
lastli
=
null
;
var
partitionAmount
=
$
(
"
imput#partitionAmount
"
).
val
();
$
(
"
#slappart li
"
).
each
(
function
(){
lastli
=
$
(
this
);
$
(
this
).
find
(
"
input:radio
"
).
change
(
function
(){
configRadio
();
});
});
lastli
.
css
(
"
border-bottom
"
,
"
none
"
);
function
setupFileTree
(){
function
setupFileTree
(){
var
root
=
$
(
"
input#root
"
).
val
();
var
root
=
$
(
"
input#root
"
).
val
();
...
@@ -79,7 +91,22 @@ $(document).ready( function() {
...
@@ -79,7 +91,22 @@ $(document).ready( function() {
}
}
});
});
}
}
function
configRadio
(){
$
(
"
#slappart li
"
).
each
(
function
()
{
var
$radio
=
$
(
this
).
find
(
"
input:radio
"
);
var
boxselector
=
"
#box
"
+
$radio
.
attr
(
'
id
'
);
if
(
$
(
this
).
hasClass
(
'
checked
'
)){
$
(
this
).
removeClass
(
'
checked
'
);
$
(
boxselector
).
slideUp
(
"
normal
"
);
}
if
(
$radio
.
is
(
'
:checked
'
)){
$
(
this
).
addClass
(
'
checked
'
);
//change content here
$
(
boxselector
).
slideDown
(
"
normal
"
);
}
});
}
function
setupEditor
(){
function
setupEditor
(){
editor
=
ace
.
edit
(
"
editor
"
);
editor
=
ace
.
edit
(
"
editor
"
);
editor
.
setTheme
(
"
ace/theme/crimson_editor
"
);
editor
.
setTheme
(
"
ace/theme/crimson_editor
"
);
...
@@ -91,4 +118,12 @@ $(document).ready( function() {
...
@@ -91,4 +118,12 @@ $(document).ready( function() {
editor
.
renderer
.
setHScrollBarAlwaysVisible
(
false
);
editor
.
renderer
.
setHScrollBarAlwaysVisible
(
false
);
editor
.
setReadOnly
(
true
);
editor
.
setReadOnly
(
true
);
}
}
function
setupSlappart
(){
for
(
var
i
=
0
;
i
<
partitionAmount
;
i
++
){
var
elt
=
$
(
"
#slappart
"
+
i
+
"
Parameter
"
);
if
(
elt
!=
undefined
)
elt
.
click
(
function
(){
alert
(
elt
.
attr
(
'
id
'
));
});
}
}
});
});
\ No newline at end of file
slapos/runner/templates/instanceInspect.html
View file @
0f7a4d3e
...
@@ -14,58 +14,86 @@
...
@@ -14,58 +14,86 @@
{% endblock %}
{% endblock %}
{% block body %}
{% block body %}
<input
type=
'hidden'
name=
'root'
id=
'root'
value=
'{%if file_path != "" %}{{file_path}}{%endif%}'
/>
<input
type=
'hidden'
name=
'root'
id=
'root'
value=
'{%if file_path != "" %}{{file_path}}{%endif%}'
/>
<input
type=
"hidden"
name=
"partition_amount"
id=
"partitionAmount"
value=
"{{ partition_amount }}"
/>
<h2>
Instance inspection
</h2><br/>
<h2>
Instance inspection
</h2><br/>
<div
id=
"tabContaier"
>
<div
id=
"tabContaier"
>
<ul>
<ul>
<li><a
class=
"active"
href=
"#tab1"
>
Parameters
</a></li>
<li><a
href=
"#tab1"
class=
"active"
>
Slapgrid Supervisor
</a></li>
<li><a
href=
"#tab2"
>
Slapgrid Supervisor
</a></li>
<li><a
href=
"#tab2"
>
SLAP Response
&
Parameters
</a></li>
<li><a
href=
"#tab3"
>
SLAP response
</a></li>
<li><a
href=
"#tab3"
>
Partitions Content
</a></li>
<li><a
href=
"#tab4"
>
Partitions Content
</a></li>
</ul>
<!-- //Tab buttons -->
</ul>
<!-- //Tab buttons -->
<div
class=
"tabDetails"
>
<div
class=
"tabDetails"
>
<div
id=
"tab1"
class=
"tabContents"
>
<div
id=
"tab1"
class=
"tabContents"
>
<p>
Add your instance parameters here and click on the update button
</p>
<textarea
class=
"parameter"
id=
"parameter"
></textarea>
<input
type=
"submit"
name=
"update"
id =
"update"
value=
"Update"
class=
"button"
/>
</div>
<!-- end tab1 -->
<div
id=
"tab2"
class=
"tabContents"
>
<p>
This tab show all process generated by slapgrid for your application. You can click on the process name to display log.
</p>
<p>
This tab show all process generated by slapgrid for your application. You can click on the process name to display log.
</p>
{% if supervisor
!= []
%}
{% if supervisor %}
<table
cellpadding=
"0"
cellspacing=
"0"
width=
"100%"
>
<table
cellpadding=
"0"
cellspacing=
"0"
width=
"100%"
>
<tr>
<tr>
<th>
Partition and Process name
</th><th>
Status
</th><th>
Process PID
</th><th>
UpTime
</th><th></th>
<th>
Partition and Process name
</th><th>
Status
</th><th>
Process PID
</th><th>
UpTime
</th><th></th>
</tr>
</tr>
{% for item in supervisor %}
{% for item in supervisor %}
<tr>
<tr>
<td><b><a
href=
"{{ url_for('tailProcess', process=item[0]) }}"
>
{{ item[0]}}
</a></b></td>
<td
class=
'first'
><b><a
href=
"{{ url_for('tailProcess', process=item[0]) }}"
>
{{ item[0]}}
</a></b></td>
<td
align=
"center"
><a
href=
"{{ url_for('startStopProccess', process=item[0], action=item[1]) }}"
>
{{ item[1]}}
</a></td>
<td
align=
"center"
><a
href=
"{{ url_for('startStopProccess', process=item[0], action=item[1]) }}"
>
{{ item[1]}}
</a></td>
<td
align=
"center"
>
{{ item[3]}}
</td><td>
{{ item[5]}}
</td>
<td
align=
"center"
>
{{ item[3]}}
</td><td>
{{ item[5]}}
</td>
<td
align=
"center"
><a
href=
"{{ url_for('startStopProccess', process=item[0], action='RESTART') }}"
>
Restart
</a></td>
<td
align=
"center"
><a
href=
"{{ url_for('startStopProccess', process=item[0], action='RESTART') }}"
>
Restart
</a></td>
</tr>
</tr>
{% endfor %}
{% endfor %}
</table>
</table><br/>
<a
href=
"{{ url_for('stopAllPartition') }}"
class=
"lshare simple"
>
Stop all process
</a>
{% else %}
{% else %}
<h2>
No process to display, please run your instance
</h2>
<h2>
No process to display, please run your instance
</h2>
{%endif%}
{%endif%}
</div>
<!-- end tab2 -->
</div>
<!-- end tab1 -->
<div
id=
"tab3"
class=
"tabContents"
>
<div
id=
"tab2"
class=
"tabContents"
>
{% if slap_status %}
<p>
Uses parameters below to run your application
</p>
<p>
Uses parameters below to run your application
</p>
<table
cellpadding=
"0"
cellspacing=
"0"
width=
"100%"
>
<div
class=
"menu-box-right"
style=
"width: 597px;"
>
<div
style=
"background:#fff; padding:10px;"
>
{% for item in slap_status %}
{% for item in slap_status %}
<div
id=
"box{{item[0]}}"
style=
"display:none;"
>
{% if item[1] %}
<!--<h2><span style="float:left; margin-left:10px;" id="{{item[0]}}title">Slap Response for {{item[0]}}</span>
<a href="#" id="{{item[0]}}Parameter" rel="{{item[0]}}" class="lshare simple" style="float:right">SLAP Parameters</a>
</h2>-->
<h2>
Slap Response for {{item[0]}}
</h2>
<div
class=
"clear"
></div><br/>
<div
id=
"bcontent{{item[0]}}"
>
<table
cellpadding=
"0"
cellspacing=
"0"
width=
"100%"
>
<tr>
<tr>
<th
align=
'left'
colspan=
'2'
>
Computer Partition {{ item[0]}}
</th>
<th>
Parameter Name
</th><th>
Parameter Value
</th>
</tr>
</tr>
{% for k in item[1] %}
{% for k in item[1] %}
<tr>
<tr>
<td
>
{{k}}
</td><td
align=
'left'
>
{{item[1][k]}}
</td>
<td
class=
"propertie first"
>
{{k}}
</td><td
align=
'left'
>
{{item[1][k]}}
</td>
</tr>
</tr>
{% endfor %}
{% endfor %}
{% endfor %}
</table>
</table>
</div>
<!-- end tab3 -->
</div>
<div
id=
"tab4"
class=
"tabContents"
>
{% else %}
<h2>
Empty Partition
</h2></br>
<center><img
alt=
""
src=
"{{ url_for('static', filename='images/empty.png') }}"
/></center>
<br/><h2>
Partition {{item[0]}} is still empty
</h2>
{%endif%}
</div>
{% endfor %}
</div>
</div>
<div
class=
"menu-box-left"
style=
"width: 110px;"
>
<ul
id=
"slappart"
>
{% for item in slap_status %}
<li><input
type=
"radio"
name=
"slapresponse"
id=
"{{item[0]}}"
value=
"{{item[0]}}"
/>
<label
for=
"{{item[0]}}"
{%
if
item
[
1
]
%}
style=
"font-weight:bold"
{%
endif
%}
>
{{item[0]}}
</label></li>
{% endfor %}
</ul>
</div>
<div
class=
"clear"
></div><br/>
{% else %}
<h2>
No response. Please run Software Instance!
</h2>
{%endif%}
</div>
<!-- end tab2 -->
<div
id=
"tab3"
class=
"tabContents"
>
<div
id=
"fileTree"
class=
"file_tree_tabs"
></div>
<div
id=
"fileTree"
class=
"file_tree_tabs"
></div>
</div>
<!-- end tab
4
-->
</div>
<!-- end tab
3
-->
</div>
</div>
</div>
</div>
<!-- This contains the hidden content for inline calls -->
<!-- This contains the hidden content for inline calls -->
...
...
slapos/runner/utils.py
View file @
0f7a4d3e
...
@@ -86,9 +86,11 @@ def updateProxy(config):
...
@@ -86,9 +86,11 @@ def updateProxy(config):
else
:
else
:
partition_parameter_kw
=
None
partition_parameter_kw
=
None
computer
.
updateConfiguration
(
xml_marshaller
.
dumps
(
slap_config
))
computer
.
updateConfiguration
(
xml_marshaller
.
dumps
(
slap_config
))
slap
.
registerOpenOrder
().
request
(
profile
,
partition_reference
=
partition_reference
,
s
r_request
=
s
lap
.
registerOpenOrder
().
request
(
profile
,
partition_reference
=
partition_reference
,
partition_parameter_kw
=
partition_parameter_kw
,
software_type
=
None
,
partition_parameter_kw
=
partition_parameter_kw
,
software_type
=
None
,
filter_kw
=
None
,
state
=
None
,
shared
=
False
)
filter_kw
=
None
,
state
=
None
,
shared
=
False
)
#open(param_path, 'w').write(xml_marshaller.dumps(sr_request.
# getInstanceParameterDict()))
return
True
return
True
def
readPid
(
file
):
def
readPid
(
file
):
...
@@ -257,9 +259,15 @@ def getSlapStatus(config):
...
@@ -257,9 +259,15 @@ def getSlapStatus(config):
try
:
try
:
for
partition
in
computer
.
getComputerPartitionList
():
for
partition
in
computer
.
getComputerPartitionList
():
# Note: Internal use of API, as there is no reflexion interface in SLAP
# Note: Internal use of API, as there is no reflexion interface in SLAP
partition_list
.
append
((
partition
.
getId
(),
partition
.
_connection_dict
.
copy
()))
partition_list
.
append
((
partition
.
getId
(),
partition
.
_connection_dict
.
copy
(),
partition
.
_parameter_dict
.
copy
()))
except
Exception
:
except
Exception
:
pass
pass
if
partition_list
:
for
i
in
xrange
(
0
,
int
(
config
[
'partition_amount'
])):
slappart_id
=
'%s%s'
%
(
"slappart"
,
i
)
if
not
[
x
[
0
]
for
x
in
partition_list
if
slappart_id
==
x
[
0
]]:
partition_list
.
append
((
slappart_id
,
[]))
return
partition_list
return
partition_list
def
runBuildoutAnnotate
(
config
):
def
runBuildoutAnnotate
(
config
):
...
...
slapos/runner/views.py
View file @
0f7a4d3e
...
@@ -91,7 +91,7 @@ def inspectInstance():
...
@@ -91,7 +91,7 @@ def inspectInstance():
result
=
[]
result
=
[]
return
render_template
(
'instanceInspect.html'
,
return
render_template
(
'instanceInspect.html'
,
file_path
=
file_content
,
supervisor
=
result
,
slap_status
=
getSlapStatus
(
app
.
config
),
file_path
=
file_content
,
supervisor
=
result
,
slap_status
=
getSlapStatus
(
app
.
config
),
supervisore
=
result
)
supervisore
=
result
,
partition_amount
=
app
.
config
[
'partition_amount'
]
)
@
app
.
route
(
'/removeInstance'
)
@
app
.
route
(
'/removeInstance'
)
def
removeInstance
():
def
removeInstance
():
...
...
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